home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 37
/
Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso
/
Aminet
/
game
/
role
/
GRAC2.lha
/
source
/
GRACplayer2.amos
/
GRACplayer2.amosSourceCode
< prev
Wrap
AMOS Source Code
|
1999-04-06
|
101KB
|
3,365 lines
Set Buffer 100 : Request Off : Auto View Off : Bob Update Off : Synchro Off
'NAME$=Command Line$ : Amos To Front : Amos Lock : Close Workbench
NAME$="work:bud/bud2.grac2"
'NAME$="work:GRAC2.0/gracdemo2/lethal_formula"
'NAME$="work:cdstuff/experiment.grac2"
'NAME$="work:cdstuff/tutorial/tutorial.grac2"
'main
Dim TXT$(1999) : Dim CH(99,1) : Dim CH$(99) : Dim DEV$(99)
Dim B0B(99,5) : Dim ROOM(99,3) : Dim CHACT(10,99) : Dim CONT(3)
Dim PIC(99) : Dim AN1M(99) : Dim SAM(99) : Dim CL0SE(99,3) : Dim ST(225)
Global B0B(),ROOM(),PIC(),AN1M(),ST(),CONT(),CHACT(),SAM(),TXT$(),CH$(),DEV$(),CH(),CL0SE()
'controls
Dim CSTUFF(15) : Dim VB(11,9) : Dim VB$(1,9) : Dim CZONE(8,15)
Global CSTUFF(),VB(),VB$(),CZONE()
'inventory
Dim INV(11,99) : Dim INV$(99)
Global INV(),INV$()
'room
Dim WK(12,31) : Dim BK(23,31) : Dim FR(21,15) : Dim PNT(3,15) : Dim BK$(31) : Dim FR$(15)
Global WK(),BK(),FR(),PNT(),FR$(),BK$()
'general
Dim CL(4,1) : Dim OL(2,2) : Dim VO(9) : Dim LODST(255,2) : Dim PRT$(5,10) : Dim FLAG(999) : Dim M1NV(4,10)
Dim ER$(11) : Dim PAL(31) : Dim A(15,2) : Dim F0NT(1) : Dim FH(1) : Dim CHO1CE(10) : Dim P(4)
Global CL(),OL(),VO(),LODST(),PAL(),PRT$(),ER$(),A(),FH(),F0NT(),CHO1CE(),FLAG(),P(),M1NV()
'character control
Dim IZ(4) : Dim PX(4) : Dim PY(4) : Dim I(4) : Dim OFF(4) : Dim CRD(32,2,5)
Dim CPT(4) : Dim TURN(4) : Dim FRAME(4) : Dim ANG(4) : Dim SANG(4)
Dim D(4) : Dim IPX(4) : Dim IPY(4) : Dim FPX(4) : Dim FPY(4) : Dim ACTIVE(4)
Dim W(4) : Dim E(4) : Dim S(4) : Dim ST0P(4) : Dim FIRST(4) : Dim H(4)
Dim IZM(4) : Dim IZL(4) : Dim Z(4) : Dim ZL(4) : Dim IL(4) : Dim HL(4)
Dim CC(4) : Dim BFRAME(4)
Global IZ(),PX(),PY(),I(),OFF(),CRD(),CPT(),TURN(),FRAME(),ANG(),SANG()
Global D(),IPX(),IPY(),FPX(),FPY(),ACTIVE(),E(),W(),S(),ST0P(),FIRST(),H()
Global IZM(),IZL(),Z(),ZL(),IL(),HL(),CC(),BFRAME()
'variables
Global LODST,INVL,UTIME,HY,HXREV,VB,SCONT,SCU,VBL,ROOMSEL,ITEM,SONG,MUS,SCR0LL,MMCH,LI1,LS1,V
Global LTXT,OBJ,TYPE,OBJ2,TYPE2,XPM,YPM,FIRST,LAST,FRZE,ENTRY,STIME,P0P,CU,S4VE,NOW4LK,UPD4TE,PRT
Global INV,XOFF,YOFF,MGE,PASTEX,PASTEY,PASTE,CLICK,SOBJ,FRAMECOUNT,R,R$,CPALETTE,FLOOR,HORIZON,SCALE
Global AD,ST,B0BS,UCU,SPIC,INVD,MLINE,IN,ILEN,C0LUMN,ST4RTROOM,ST4RTCH,ST4RTPOINT,FIRSTLINE,MUS
Global GTIME,RTIME,NP,MCH,VO1CEC,VO1CEH,VO1CEX,VO1CEY,T0TAL,T1MER,TST,T0TAL2,PAUSE,T1MER2,PST,PQ
Global NAME$,MGE$,VER$
Global QG,WG,LINEG,GCH
DEF
L0ADA
MAIN
Procedure DEF
VER$="2.0"
FLAG(0)=-1 : MUS=-1 : SCR0LL=-1 : CPALETTE=-1
For E=0 To 10 : CHO1CE(E)=-1 : Next
For E=0 To 2 : OL(E,0)=-1 : Next
For E=0 To 4 : CL(E,0)=-1 : Next
ER$(0)="room"
ER$(1)="controls"
ER$(2)="inventory"
ER$(3)="close-up"
ER$(4)="picture"
ER$(5)="character"
ER$(6)="objects"
ER$(7)="sample"
ER$(8)="point"
ER$(9)="window"
ER$(10)="verb"
ER$(11)="message bar"
Erase 1 : Erase 2
Reserve As Work 98,5600 : Fill Start(98) To Start(98)+Length(98),-1
End Proc
Procedure MAIN
Do
I$=Inkey$ : I1=Scancode : S1=Scanshift : If LI1>0 : I1=LI1 : S1=LS1 : End If
If I1>79 and I1<90
If S1>0
If Not S4VE
CHECK["save game"+Str$(I1-79)]
If Param : SAVGAME[I1-80] : End If
End If
Else
If LI1>0
LI1=0 : P=-1
Else
CHECK["load game"+Str$(I1-79)] : P=Param
End If
If P : LODGAME[I1-80] : End If
End If
Else If I$<>""
If I$="c" : MGE["Chip free "+Str$(Chip Free)] : End If
If I$="m" : MGE["Memory free "+Str$(Chip Free+Fast Free)] : End If
If I$="v" : MGE["Version "+VER$] : End If
If I$="q"
CHECK["quit?"]
If Param : End : End If
End If
End If
Screen 0
If Scin(X Mouse,Y Mouse)=0
If ACTIVE(MCH)<0
If Mouse Key=1 or NP=-1
NP=0 : While Mouse Key<>0 : Wend
X=X Screen(X Mouse) : Y=Y Screen(Y Mouse)
PREMOVE[X,Y]
MOVE[XPM,YPM,MCH,-1,-1]
WA1TSTOP[MCH,0]
Else If Mouse Key=2 or NP=-2
NP=0 : While Mouse Key<>0 : Wend
ACTION
I=-1 : B=-1 : C=16 : P=5 : ITEM=0 : OBJ2=-1
End If
Else
If Mouse Key<>0 : NP=-1*Mouse Key : End If
End If
If INVD=1
PR1NT[""] : INVD=0
End If
Else If Scin(X Mouse,Y Mouse)=7
If Mouse Key<>0 or NP<>0
NP=0 : FINDBUTTON
While Mouse Key<>0 : Wend
If VB(10,VB)>3 and ITEM=0 and OBJ2<>-1
ITEM=-1 : I=-1 : B=-1 : C=16 : P=5
Else If(ITEM=-1 or VB(10,VB)<4) and OBJ<>-1
ACTION
I=-1 : B=-1 : C=16 : P=5 : ITEM=0 : OBJ2=-1
End If
End If
If INVD=0 and(VB(10,VB)<>3 and(VB(10,VB)<>6 or ITEM=0))
INVENTORY : INVD=1
Else If INVD=1 and Not(VB(10,VB)<>3 and(VB(10,VB)<>6 or ITEM=0))
PR1NT[""] : INVD=0
End If
End If
I=-1 : C=16 : B=-1 : P=5 : OBJ=-1 : Screen 0 : XM=X Mouse : YM=Y Mouse
If Scin(XM,YM)=0
For C=1 To 15
C0L[C,XM,YM] : If Param and FR$(C)<>"" : Exit : End If
Next
FINDBACK[XM,YM] : B=Param : If B<>-1 : C=16 : End If
For P=0 To 4
If P<>MCH
C0L[20+P,XM,YM] : If Param : C=16 : B=-1 : Exit : End If
End If
Next
Else
FINDINV[X Mouse,Y Mouse] : I=Param
End If
If VB(10,VB)<4
INV=2 : RM=3
MGE1$=VB$(0,VB)+" "
Gosub GTMGE
Else
If ITEM=0
OBJ2=-1 : MGE1$=VB$(0,VB)+" "
If I>-1
OBJ2=I
MGE1$=MGE1$+INV$(I)
End If
Else
INV=5 : RM=6
MGE1$=VB$(0,VB)+" "+INV$(OBJ2)+" "+VB$(1,VB)+" "
Gosub GTMGE
End If
End If
If Timer-UTIME>5
If MGE2$<>MGE1$ : MGE[MGE1$] : MGE2$=MGE1$ : MGE1$="" : End If
IZL(MCH)=IZM(MCH)
UPD4TE[0] : IZM(MCH)=IZ(MCH)
If IZM(MCH)<>IZL(MCH)
If WK(11,IZM(MCH))<>-1
ST[WK(11,IZM(MCH))]
End If
End If
If T0TAL2>0 and T1MER>=T0TAL2
T0TAL2=0 : ST[TST]
End If
If PAUSE>0 and T1MER2>=PAUSE
PAUSE=-1 : ST[PST]
End If
End If
Loop
GTMGE:
If VB(10,VB)=INV
C=16 : B=-1 : P=5
Else If VB(10,VB)=RM
I=-1
End If
If C<>16
OBJ=C : MGE1$=MGE1$+FR$(C) : TYPE=0
Else If B<>-1
OBJ=B : MGE1$=MGE1$+BK$(B) : TYPE=1
Else If I>-1
OBJ=I : MGE1$=MGE1$+INV$(I) : TYPE=2
Else If P<>5
OBJ=P : MGE1$=MGE1$+CH$(B0B(ROOM(ROOMSEL,2),P+1)) : TYPE=3
End If
Return
End Proc
Procedure MOVE[MX,MY,CH,FZ0NE,TURN]
If ACTIVE(CH)=0 : Pop Proc : End If
If NOW4LK : Pop Proc : End If
Change Mouse 1+SCONT+4
ST0P(CH)=-1
While ACTIVE(CH)<>-1 : Gosub CHECK : Wend
ST0P(CH)=0
TURN(CH)=TURN
TIME=Timer
Dim ROUTE(99,1)
Dim PTS(99)
For Q=0 To 99
PTS(Q)=-1
Next
' make list of zones to go through
PTS(0)=IZ(CH)
PNTER2=1
CHANGE=1
Do
Gosub CHECK
If PTS(PNTER1)=-1 : CHANGE=0 : Exit : End If
Z0NE=PTS(PNTER1) : Inc PNTER1
If(MX>=WK(0,Z0NE))<>(MX>WK(2,Z0NE)) and(MY>=WK(1,Z0NE))<>(MY>WK(3,Z0NE))
If FZ0NE=-1 or Z0NE=FZ0NE
FZ=Z0NE
Exit
End If
End If
For W=4 To 7
If WK(W,Z0NE)<>-1
If ROUTE(WK(W,Z0NE),1)=0 and WK(12,WK(W,Z0NE))
ROUTE(WK(W,Z0NE),1)=1
ROUTE(WK(W,Z0NE),0)=Z0NE
PTS(PNTER2)=WK(W,Z0NE) : Inc PNTER2
End If
End If
Next
Loop
If CHANGE=0 : Change Mouse 1+SCONT+3 : Pop Proc : End If
' make list of points
Z0NE=FZ
Q=0
While Z0NE<>IZ(CH)
PTS(Q)=Z0NE : Inc Q
Z0NE=ROUTE(Z0NE,0)
Wend
PTS(Q)=IZ(CH)
'list of coordinates
CRD(0,0,CH)=PX(CH)
CRD(0,1,CH)=PY(CH)
CRD(0,2,CH)=PTS(Q)
CRD(Q+1,0,CH)=MX
CRD(Q+1,1,CH)=MY
CRD(Q+1,2,CH)=PTS(0)
CPT=1
If Q>0
For Z0NE=Q To 1 Step -1
Gosub CHECK
N=-1 : Gosub CORNERS
PX=CRD(CPT-1,0,CH)
PY=CRD(CPT-1,1,CH)
CRD(CPT,2,CH)=PTS(Q-CPT)
TX=0 : TY=0 : T=0
If BX and AY : TY=TY+SY1 : TX=TX+LX2 : Inc T : End If
If AY and Not AX : TY=TY+SY1 : TX=TX+SX2 : Inc T : End If
If BX and Not BY : TY=TY+LY1 : TX=TX+LX2 : Inc T : End If
If Not(AX or BY) : TY=TY+LY1 : TX=TX+SX2 : Inc T : End If
If Not(BX or AY) : TY=TY+SY2 : TX=TX+LX1 : Inc T : End If
If BY and Not BX : TY=TY+LY2 : TX=TX+LX1 : Inc T : End If
If AX and Not AY : TY=TY+SY2 : TX=TX+SX1 : Inc T : End If
If AX and BY : TY=TY+LY2 : TX=TX+SX1 : Inc T : End If
CRD(CPT,0,CH)=TX/T
CRD(CPT,1,CH)=TY/T
Inc CPT
Next
For Z0NE=0 To Q-1
Gosub CHECK
N=1 : Gosub CORNERS
Dec CPT
D=1000
PX=CRD(CPT+1,0,CH)
PY=CRD(CPT+1,1,CH)
NX=CRD(CPT-1,0,CH)
NY=CRD(CPT-1,1,CH)
If BX and AY : D1=Sqr((PY-SY1)*(PY-SY1)+(PX-LX2)*(PX-LX2))+Sqr((NY-SY1)*(NY-SY1)+(NX-LX2)*(NX-LX2))
If D1<D : D=D1 : CRD(CPT,0,CH)=LX2 : CRD(CPT,1,CH)=SY1 : End If : End If
If AY and Not AX : D1=Sqr((PY-SY1)*(PY-SY1)+(PX-SX2)*(PX-SX2))+Sqr((NY-SY1)*(NY-SY1)+(NX-SX2)*(NX-SX2))
If D1<D : D=D1 : CRD(CPT,0,CH)=SX2 : CRD(CPT,1,CH)=SY1 : End If : End If
If BX and Not BY : D1=Sqr((PY-LY1)*(PY-LY1)+(PX-LX2)*(PX-LX2))+Sqr((NY-LY1)*(NY-LY1)+(NX-LX2)*(NX-LX2))
If D1<D : D=D1 : CRD(CPT,0,CH)=LX2 : CRD(CPT,1,CH)=LY1 : End If : End If
If Not(AX or BY) : D1=Sqr((PY-LY1)*(PY-LY1)+(PX-SX2)*(PX-SX2))+Sqr((NY-LY1)*(NY-LY1)+(NX-SX2)*(NX-SX2))
If D1<D : D=D1 : CRD(CPT,0,CH)=SX2 : CRD(CPT,1,CH)=LY1 : End If : End If
If Not(BX or AY) : D1=Sqr((PY-SY2)*(PY-SY2)+(PX-LX1)*(PX-LX1))+Sqr((NY-SY2)*(NY-SY2)+(NX-LX1)*(NX-LX1))
If D1<D : D=D1 : CRD(CPT,0,CH)=LX1 : CRD(CPT,1,CH)=SY2 : End If : End If
If BY and Not BX : D1=Sqr((PY-LY2)*(PY-LY2)+(PX-LX1)*(PX-LX1))+Sqr((NY-LY2)*(NY-LY2)+(NX-LX1)*(NX-LX1))
If D1<D : D=D1 : CRD(CPT,0,CH)=LX1 : CRD(CPT,1,CH)=LY2 : End If : End If
If AX and Not AY : D1=Sqr((PY-SY2)*(PY-SY2)+(PX-SX1)*(PX-SX1))+Sqr((NY-SY2)*(NY-SY2)+(NX-SX1)*(NX-SX1))
If D1<D : D=D1 : CRD(CPT,0,CH)=SX1 : CRD(CPT,1,CH)=SY2 : End If : End If
If AX and BY : D1=Sqr((PY-LY2)*(PY-LY2)+(PX-SX1)*(PX-SX1))+Sqr((NY-LY2)*(NY-LY2)+(NX-SX1)*(NX-SX1))
If D1<D : D=D1 : CRD(CPT,0,CH)=SX1 : CRD(CPT,1,CH)=LY2 : End If : End If
Next
CPT=Q+1 : NREP=0
Repeat
REP=0 : Inc NREP
F1RST=0 : L4ST=F1RST+2
While L4ST<=CPT
While L4ST<=CPT
Gosub CHECK
IPX=CRD(F1RST,0,CH) : IPY=CRD(F1RST,1,CH)
FPX=CRD(L4ST,0,CH) : FPY=CRD(L4ST,1,CH)
D=Sqr((IPX-FPX)*(IPX-FPX)+(IPY-FPY)*(IPY-FPY))/2
D=Max(D,1)
R=F1RST+1
For W=1 To D
PX=IPX+(W*(FPX-IPX))/D
PY=IPY+(W*(FPY-IPY))/D
If(PX>=WK(0,CRD(R,2,CH)))<>(PX>WK(2,CRD(R,2,CH))) and(PY>=WK(1,CRD(R,2,CH)))<>(PY>WK(3,CRD(R,2,CH)))
If Abs(CRD(R,0,CH)-PX)>3 or Abs(CRD(R,1,CH)-PY)>3 : REP=-1 : End If
CRD(R,0,CH)=PX : CRD(R,1,CH)=PY
Inc R : If R=L4ST : Exit : End If
Else If(PX>=WK(0,CRD(R-1,2,CH)))=(PX>WK(2,CRD(R-1,2,CH))) or(PY>=WK(1,CRD(R-1,2,CH)))=(PY>WK(3,CRD(R-1,2,CH)))
Exit 2
End If
Next
Inc L4ST
Wend
Inc F1RST : L4ST=F1RST+2
Wend
Until REP=0 or NREP>1
End If
CPT(CH)=CPT
ACTIVE(CH)=-2
FRAME(CH)=0
FIRST(CH)=0
Change Mouse 1+SCONT+3
Pop Proc
CHECK:
If Timer-UTIME>6
UPD4TE[0]
End If
Return
CORNERS:
SX1=WK(0,PTS(Z0NE))
LX1=WK(2,PTS(Z0NE))
SX2=WK(0,PTS(Z0NE+N))
LX2=WK(2,PTS(Z0NE+N))
SY1=WK(1,PTS(Z0NE))
LY1=WK(3,PTS(Z0NE))
SY2=WK(1,PTS(Z0NE+N))
LY2=WK(3,PTS(Z0NE+N))
If SX1<SX2
AX=0
If LX1<LX2
BX=0
Else
BX=-1
End If
Else
AX=-1
If LX1<LX2
BX=0
Else
BX=-1
End If
End If
If SY1<SY2
AY=0
If LY1<LY2
BY=0
Else
BY=-1
End If
Else
AY=-1
If LY1<LY2
BY=0
Else
BY=-1
End If
End If
Return
End Proc
Procedure WALK[E,W,CH]
DX=(E*(FPX(CH)-IPX(CH))*Z(CH))/(D(CH)*64)
DY=(E*(FPY(CH)-IPY(CH))*Z(CH))/(D(CH)*64)
PX(CH)=IPX(CH)+DX
PY(CH)=IPY(CH)+DY
Y1=WK(1,CRD(W-1,2,CH))
Y2=WK(3,CRD(W-1,2,CH))
Y3=WK(8,CRD(W-1,2,CH))
Y4=WK(9,CRD(W-1,2,CH))
If Y1<>Y2
OFF(CH)=(PY(CH)*(Y4-Y3)-Y1*Y4+Y2*Y3)/(Y2-Y1)
Else
OFF(CH)=(Y3+Y4)/2
End If
DX=4 : DY=2
EOL=Abs(PX(CH)-FPX(CH))<=DX and Abs(PY(CH)-FPY(CH))<=DY
If(W=CPT(CH) and EOL) or ST0P(CH)
If Not ST0P(CH)
If TURN(CH)=1
SANG(CH)=0
Else If TURN(CH)=2
SANG(CH)=$8000
Else If TURN(CH)=3
SANG(CH)=2
Else If TURN(CH)=4
SANG(CH)=1
End If
TURN[SANG(CH),CH]
End If
I(CH)=1+SANG(CH)
If SANG(CH)<100
H(CH)=37+4*SANG(CH)
Else H(CH)=37+SANG(CH)
End If
ACTIVE(CH)=-1 : IZ(CH)=CRD(W,2,CH)
If ST0P(CH) : IZ(CH)=CRD(W-1,2,CH) : End If
Else
Add FRAME(CH),1,0 To 7
I(CH)=4+FRAME(CH)+ANG(CH)
If EOL : ACTIVE(CH)=-2 : IZ(CH)=CRD(W,2,CH) : End If
End If
End Proc
Procedure SWALK[W,CH]
AL=ANG(CH)
IPX(CH)=CRD(W-1,0,CH) : IPY(CH)=CRD(W-1,1,CH)
FPX(CH)=CRD(W,0,CH) : FPY(CH)=CRD(W,1,CH)
PX(CH)=IPX(CH) : PY(CH)=IPY(CH)
Trap ANG#=Abs((IPX(CH)-FPX(CH))*(IPY(CH)-FPY(CH))^(-1))
If Errtrap>0
ANG#=2
End If
If ANG#>1
If FPX(CH)>IPX(CH)
ANG(CH)=0
Else
ANG(CH)=$8000
End If
Else
If Abs(FPY(CH)-IPY(CH))>3
If(FPY(CH)>IPY(CH))=WK(9,CRD(W-1,2,CH))>(WK(8,CRD(W-1,2,CH)))
ANG(CH)=8
Else
ANG(CH)=16
End If
End If
End If
SANG1=ANG(CH)
If ANG(CH)=8 : SANG1=1 : End If
If ANG(CH)=16 : SANG1=2 : End If
If ANG(CH)<>AL and W<>1
FRAME(CH)=FRAME(CH)+4
End If
If ANG(CH)<>0 and ANG(CH)<>$8000
D(CH)=Abs((IPY(CH)-FPY(CH)))/3
Else
D(CH)=Abs((IPX(CH)-FPX(CH)))/5
End If
If D(CH)=1 : D(CH)=2 : End If
If W=CPT(CH) : If D(CH)=0 : D(CH)=1 : End If : End If
If D(CH)>0
If W(CH)=1
TURN[SANG1,CH]
End If
SANG(CH)=SANG1
End If
If D(CH)=0
IZ(CH)=CRD(W,2,CH)
Else
ACTIVE(CH)=-3
End If
End Proc
Procedure PLACE[CH,PNT]
PNT=16-PNT
PX(CH)=PNT(0,PNT)
PY(CH)=PNT(1,PNT)
TURN(CH)=PNT(2,PNT)
Y1=WK(1,PNT(3,PNT))
Y2=WK(3,PNT(3,PNT))
Y3=WK(8,PNT(3,PNT))
Y4=WK(9,PNT(3,PNT))
Trap OFF(CH)=(PY(CH)*(Y4-Y3)-Y1*Y4+Y2*Y3)/(Y2-Y1)
If Errtrap<>0 : ERR0R[8,15-PNT,3] : End If
If TURN(CH)=1
SANG(CH)=0
Else If TURN(CH)=2
SANG(CH)=$8000
Else If TURN(CH)=3
SANG(CH)=2
Else If TURN(CH)=4
SANG(CH)=1
End If
TURN[SANG(CH),CH]
I(CH)=1+SANG(CH)
If SANG(CH)<100
H(CH)=37+4*SANG(CH)
Else H(CH)=37+SANG(CH)
End If
ACTIVE(CH)=-1
IZ(CH)=PNT(3,PNT)
IZM(CH)=-1
End Proc
Procedure L0ADR[ROOMSEL]
OPENFILE[ROOM(ROOMSEL,0),Str$(ROOMSEL)+".room",ROOM(ROOMSEL,3),0,ROOMSEL]
Sam Stop : For Q=100 To 199 : If Length(Q)>0 : Erase Q : End If : Next : Extension_19_0062 15
For Q=30 To 45 : If Length(Q)>0 : Erase Q : End If : Next
For Q=0 To 15 : A(Q,0)=0 : FR(21,Q)=0 : Next
RTIME=0 : PAUSE=0 : HORIZON=0 : FLOOR=0 : SCALE=100
For Q=0 To 15
For W=0 To 11
RD : WK(W,Q)=R
Next
For W=0 To 11
RD : WK(W,Q+16)=R
Next
For W=0 To 22
RD : BK(W,Q)=R
Next
For W=0 To 22
RD : BK(W,Q+16)=R
Next
For W=0 To 20
RD : FR(W,Q)=R
Next
For W=0 To 3
RD : PNT(W,Q)=R
Next
Next
For Q=0 To 49
RD : ST(Q)=R
Next
Reserve As Work 20,Leek(AD)+4
Copy AD,AD+Leek(AD) To Start(20)
AD=AD+Leek(AD)
For Q=0 To 100
RT : T$=R$
Next
For Q=1000 To 1999
RT : TXT$(Q)=R$
Next
For Q=0 To 15
RT : BK$(Q)=R$
RT : BK$(Q+16)=R$
RT : FR$(Q)=R$
Next
Erase 17
OK=0
If ROOM(ROOMSEL,2)=-1 : ERR0R[6,-1,4] : End If
For Q=0 To 2
If OL(Q,0)>-1
If ROOM(ROOMSEL,2)=OL(Q,0) : OK=-1 : SOBJ=OL(Q,1) : End If
If OL(Q,0)<>CONT(2) and OL(Q,0)<>ROOM(ROOMSEL,2)
For W=1 To 100 : Del Bob OL(Q,1)+1 : Next : OL(Q,0)=-1 : OL(Q,2)=0
O=OL(Q,1) : Gosub CORRECTOBJ
End If
End If
Next
If Not OK
For Q=0 To 4
CC(Q)=Q
If CL(Q,0)>-1
OK=0
For W=0 To 4
If B0B(ROOM(ROOMSEL,2),W+1)=CL(Q,0) : OK=-1 : End If
Next
If Not OK
For W=1 To 100 : Del Bob CL(Q,1)+1 : Next : CL(Q,0)=-1
O=CL(Q,1) : Gosub CORRECTOBJ
End If
End If
Next
REQUEST[B0B(ROOM(ROOMSEL,2),0),0]
Trap Load DEV$(B0B(ROOM(ROOMSEL,2),0))+"GRAC"+Str$(ROOM(ROOMSEL,2))+".object",1
If Errtrap<>0 : ERR0R[6,ROOM(ROOMSEL,2),1] : End If
SOBJ=Length(1)-100 : Amreg(25)=SOBJ
For Q=0 To 2 : If OL(Q,0)=-1 : OL(Q,0)=ROOM(ROOMSEL,2) : OL(Q,1)=SOBJ : Exit : End If : Next
End If
For Q=0 To 2 : If OL(Q,0)=ROOM(ROOMSEL,2) : Exit : End If : Next
If Not OL(Q,2)
OL(Q,2)=-1
For Q=0 To 4
If B0B(ROOM(ROOMSEL,2),Q+1)>-1
OK=0
For W=0 To 4 : If CL(W,0)=B0B(ROOM(ROOMSEL,2),Q+1) : OK=-1 : Exit : End If : Next
If Not OK
REQUEST[CH(B0B(ROOM(ROOMSEL,2),Q+1),0),0]
Trap Load DEV$(CH(B0B(ROOM(ROOMSEL,2),Q+1),0))+"GRAC"+Str$(B0B(ROOM(ROOMSEL,2),Q+1))+".character",1
If Errtrap<>0 : ERR0R[5,B0B(ROOM(ROOMSEL,2),Q+1),1] : End If
S(Q)=Length(1)-100
For W=0 To 4 : If CL(W,0)=-1 : CL(W,0)=B0B(ROOM(ROOMSEL,2),Q+1) : CL(W,1)=S(Q) : Exit : End If : Next
Else
S(Q)=CL(W,1)
End If
End If
Next
End If
PICSEL=ROOM(ROOMSEL,1)
REQUEST[PIC(PICSEL),0]
Trap Load DEV$(PIC(PICSEL))+"GRAC"+Str$(PICSEL)+".picture",6
If Errtrap<>0 : ERR0R[4,PICSEL,1] : End If
Trap Screen 6
If Errtrap>0
Screen Open 6,64,100,32,Lowres : Screen Hide 6
For Q=0 To 4
P(Q)=Phybase(Q)
Next
End If
Pop Proc
CORRECTOBJ:
For E=0 To 2 : If OL(E,1)>O : OL(E,1)=OL(E,1)-100 : End If : Next
For E=0 To 4 : If CL(E,1)>O : CL(E,1)=CL(E,1)-100 : End If : Next
For E=0 To 4 : If S(E)>O : S(E)=S(E)-100 : End If : Next
Return
End Proc
Procedure L0ADCU[CL0SESEL]
OPENFILE[CL0SE(CL0SESEL,0),Str$(CL0SESEL)+".closeup",CL0SE(CL0SESEL,3),3,CL0SESEL]
For Q=0 To 15
For W=0 To 8
RD : CZONE(W,Q)=R
Next
Next
For Q=201 To 225
RD : ST(Q)=R
Next
Reserve As Work 24,Leek(AD)+4
Copy AD,AD+Leek(AD) To Start(24)
AD=AD+Leek(AD)
For Q=0 To 100
RT : T$=R$
Next
Erase 17
OK=0
For Q=0 To 2
If OL(Q,0)>-1
If CL0SE(CL0SESEL,2)=OL(Q,0) : SCU=OL(Q,1) : OK=-1 : End If
End If
Next
If Not OK
REQUEST[B0B(CL0SE(CL0SESEL,2),0),0]
Trap Load DEV$(B0B(CL0SE(CL0SESEL,2),0))+"GRAC"+Str$(CL0SE(CL0SESEL,2))+".object",1
If Errtrap<>0 : ERR0R[6,CL0SE(CL0SESEL,2),1] : End If
SCU=Length(1)-100
For Q=0 To 2 : If OL(Q,0)=-1 : OL(Q,0)=CL0SE(CL0SESEL,2) : OL(Q,1)=SCU : OL(Q,2)=0 : Exit : End If : Next
End If
PICSEL=CL0SE(CL0SESEL,1)
REQUEST[PIC(PICSEL),0]
Trap Load DEV$(PIC(PICSEL))+"GRAC"+Str$(PICSEL)+".picture",6
If Errtrap<>0 : ERR0R[4,PICSEL,1] : End If
End Proc
Procedure L0ADA
Open In 1,NAME$
L=Lof(1) : Close 1
Reserve As Work 17,L
Bload NAME$,17
L2=Leek(Start(17)+4)
Erase 17 : Reserve As Work 17,L2
Bload NAME$,Start(17)
L3= Extension_5_00E4(Start(17)+8,L-8)
AD=Start(17)+8
CONT(3)=Leek(AD) : AD=AD+4
INVL=Leek(AD) : AD=AD+4
For Q=0 To 99
ROOM(Q,3)=Leek(AD) : AD=AD+4
Next
For Q=0 To 99
CL0SE(Q,3)=Leek(AD) : AD=AD+4
Next
RP : INV=R
RP : CONT(0)=R
RP : CONT(1)=R
RP : CONT(2)=R
RP : SONG=R
RP : ST4RTROOM=R
RP : ST4RTCH=R
RP : ST4RTPOINT=R
RP : SIZE1=R
RP : SIZE2=R
For Q=0 To 99
RP : CH(Q,0)=R
RP : CH(Q,1)=R
For W=0 To 5
RP : B0B(Q,W)=R
Next W
RP : ROOM(Q,0)=R
RP : ROOM(Q,1)=R
RP : ROOM(Q,2)=R
RP : CL0SE(Q,0)=R
RP : CL0SE(Q,1)=R
RP : CL0SE(Q,2)=R
RP : PIC(Q)=R
RP : AN1M(Q)=R
RP : SAM(Q)=R
Next
For Q=0 To 99
For W=0 To 10
RD : CHACT(W,Q)=R
Next
Next
For Q=150 To 200
RD : ST(Q)=R
Next
Reserve As Work 23,Leek(AD)+4
Copy AD,AD+Leek(AD) To Start(23)
AD=AD+Leek(AD)
For Q=0 To 100
RT : T$=R$
Next
For Q=0 To 999
RT : TXT$(Q)=R$
Next
For Q=0 To 99
RT : DEV$(Q)=R$
RT : CH$(Q)=R$
Next
F0NT1$=Peek$(AD,1000,"�") : AD=AD+Len(F0NT1$)+1
F0NT2$=Peek$(AD,1000,"�") : AD=AD+Len(F0NT2$)+1
MCH=ST4RTCH : MMCH=B0B(ROOM(ST4RTROOM,2),MCH+1)+1
Erase 17
Get Fonts
F0NT[F0NT1$,SIZE1,0]
F0NT[F0NT2$,SIZE2,1]
Reserve As Work 47,100
L0ADC
L0ADI
L0ADR[ST4RTROOM]
If SONG>-1
REQUEST[SONG,0]
Trap Open In 1,DEV$(SONG)+"GRAC.song"
If Errtrap=0
L=Lof(1) : Close 1
If Chip Free>L+175000
Extension_19_0006 DEV$(SONG)+"GRAC.song",2
End If
End If
End If
DR4WROOM[Max(ST4RTPOINT,1),-1]
Limit Mouse 0,0 To 1000,1000
End Proc
Procedure L0ADI
OPENFILE[INV,".inv",INVL,2,-1]
For Q=0 To 99
For W=0 To 10
RD : INV(W,Q)=R
Next
Next
For Q=60 To 149
RD : ST(Q)=R
Next
Reserve As Work 22,Leek(AD)+4
Copy AD,AD+Leek(AD) To Start(22)
AD=AD+Leek(AD)
For Q=0 To 100
RT : T$=R$
Next
For Q=0 To 99
RT : INV$(Q)=R$
Next
Erase 17
IN=0
For Q=0 To 99
L=Text Length(INV$(Q)+" ")
If L>ILEN : ILEN=L : End If
Next
IN=(CSTUFF(8)-CSTUFF(6))/ILEN
If IN>5 : IN=5 : End If
End Proc
Procedure L0ADC
OPENFILE[CONT(0),".cont",CONT(3),1,-1]
For Q=0 To 15
RD : CSTUFF(Q)=R
Next
For Q=0 To 9
For W=0 To 11
RD : VB(W,Q)=R
Next
Next
For Q=0 To 9
RD : ST(Q+50)=R
Next
Reserve As Work 21,2000
Copy AD,AD+Leek(AD) To Start(21)
AD=AD+Leek(AD)
For Q=0 To 100
RT : T$=R$
Next
For Q=0 To 9
RT : VB$(0,Q)=R$
RT : VB$(1,Q)=R$
Next
Erase 17
If CONT(1)=-1 : ERR0R[4,-1,2] : End If
If CSTUFF(6)=CSTUFF(8) or CSTUFF(7)=CSTUFF(9) : ERR0R[9,-1,2] : End If
If CSTUFF(11)=0 : ERR0R[11,-1,2] : End If
REQUEST[PIC(CONT(1)),0]
Trap Load DEV$(PIC(CONT(1)))+"GRAC"+Str$(CONT(1))+".picture",7
If Errtrap<>0 : ERR0R[4,CONT(1),1] : End If
Unpack 7 To 7 : Screen Hide 7 : Erase 7 : Set Font F0NT(0)
If CSTUFF(14)=CSTUFF(15)
LITE=1 : For C=1 To 31 : If Colour(C)>Colour(LITE) : LITE=C : End If : Next
CSTUFF(14)=LITE : CSTUFF(15)=0
End If
Screen Display 7,CSTUFF(0),CSTUFF(1),,
Double Buffer : Autoback 0 : Bob Update Off
If CONT(2)=-1 : ERR0R[6,-1,2] : End If
REQUEST[B0B(CONT(2),0),0]
Screen Open 5,CSTUFF(2),FH(1)*2+8,32,Lowres : Screen Hide 5 : Set Font F0NT(1)
Get Bob 1,0,0 To CSTUFF(2),FH(1)+4
Get Bob 5,12,0,0 To 1,1 : Del Bob 12
Trap Load DEV$(B0B(CONT(2),0))+"GRAC"+Str$(CONT(2))+".object",1
If Errtrap<>0 : ERR0R[6,CONT(2),1] : End If
SCONT=Length(1)-100 : Make Mask SCONT+1 : OL(0,0)=CONT(2) : OL(0,1)=SCONT
For VB=9 To 0 Step -1
If VB(0,VB)<>0 : Exit : End If
Next
If VB=-1 : ERR0R[10,-1,2] : End If
VBL=-1
Screen 7
MLINE=(CSTUFF(9)-CSTUFF(7))/FH(0)-1
If MLINE>10 : MLINE=10 : End If
Change Mouse 1+SCONT+3
End Proc
Procedure TURN[SANG1,CH]
If(SANG(CH)=$8000 and SANG1=0) or(SANG(CH)=0 and SANG1=$8000)
I(CH)=2 : H(CH)=37+4
Else If(SANG(CH)=1 and SANG1=2) or(SANG(CH)=2 and SANG1=1)
I(CH)=1 : H(CH)=37
End If
End Proc
Procedure DR4WROOM[PNT,NEW]
Unpack 6 To 0 : Erase 6 : Double Buffer : Autoback 0 : Screen Hide 0
Screen To Front 7
Screen Display 0,CSTUFF(4),CSTUFF(5),CSTUFF(2),CSTUFF(3)
Screen 0
Limit Mouse 0,0 To 1000,1000
Priority On
For Q=0 To 31
DR4W=-1
If BK(0,Q)<>-1
If BK(10,Q)>0
If FLAG(BK(10,Q))=0 : DR4W=0 : End If
Else If BK(10,Q)<0
If FLAG(-1*BK(10,Q))<>0 : DR4W=0 : End If
End If
If DR4W : BK(23,Q)=-1 : Else BK(23,Q)=0 : End If
End If
DR4W=-1
If WK(0,Q)<>-1
If WK(10,Q)>0
If FLAG(WK(10,Q))=0 : DR4W=0 : End If
Else If WK(10,Q)<0
If FLAG(-1*WK(10,Q))<>0 : DR4W=0 : End If
End If
If DR4W : WK(12,Q)=-1 : Else WK(12,Q)=0 : End If
End If
Next
If NEW
For E=0 To 4
If MMCH=B0B(ROOM(ROOMSEL,2),E+1)+1 : MCH=E : Exit : End If
Next
If E=5 or MMCH=0 : ERR0R[5,-1,4] : End If
For Q=0 To 4 : ACTIVE(Q)=0 : Next
GTCH
ENTRY=PNT
PLACE[MCH,PNT]
UPD4TE=0 : B0BS=0 : LODST=0
ST[0]
If UPD4TE=0
UPD4TE=-1
If B0BS=0 : B0BS : End If
UPD4TE[0]
PR1NT[""] : INVD=0
If LI1=0
UPD4TE[0] : NICEIFF[0]
End If
End If
Screen Show 7 : Show On
End If
End Proc
Procedure H0TSP0T[N]
N1=N : If N>32000 : N1=N-$8000 : End If
AD=Start(1)+2+(N1-1)*8
ADI=Leek(AD)
HX=Deek(ADI+6)
HY=Deek(ADI+8)
FLIP=Btst(15,HX)
If(N>32000)<>FLIP
Paste Bob 500,500,N : HX=Deek(ADI+6)
End If
If HY>16384 : HY=65536-HY : End If
HXREV=HX : Bclr 14,HXREV : Bclr 15,HXREV
If HXREV>16000 : HXREV=HXREV-$4000 : End If
End Proc
Procedure UPD4TE[UPD4TEM]
' On Error Goto ERR
If Not UPD4TEM
UTIME=Timer : FRAMECOUNT=Max(FRAMECOUNT-1,0) : Inc T1MER : Inc T1MER2 : Inc GTIME : Inc RTIME
If STIME>0 : If Timer>STIME : Extension_19_0062 15 : End If : End If
If Not FRZE
If MGE=-1
Screen 7 : S$="" : While Text Length(S$)<LTXT : S$=S$+" " : Wend : LTXT=Text Length(MGE$)
End If
For CH=0 To 4
If ACTIVE(CH)<0
If ACTIVE(CH)=-2
While ACTIVE(CH)=-2 : Inc W(CH) : E(CH)=0 : SWALK[W(CH),CH] : Wend
End If
If ACTIVE(CH)=-3 and FIRST(CH)
Inc E(CH) : WALK[E(CH),W(CH),CH]
Else
FIRST(CH)=-1
End If
If ACTIVE(CH)=-1 : W(CH)=0 : E(CH)=0 : End If
If S(CH)<>-1
If OFF(CH)<=HORIZON
Z(CH)=(16*SCALE)/100
Else If OFF(CH)=>FLOOR
Z(CH)=(64*SCALE)/100
Else
Z(CH)=((OFF(CH)-HORIZON)*64*SCALE)/((FLOOR-HORIZON)*100)
End If
Z(CH)=Max(Z(CH),16)
If I(CH)>32768
IR=I(CH)-32768+S(CH)
Else IR=I(CH)+S(CH)
End If
If Z(CH)<>ZL(CH) or I(CH)<>IL(CH) or H(CH)<>HL(CH)
Screen 6
If I(CH)<4 or I(CH)=32769 or I(CH)=BFRAME(CH)
AD2=Start(1)+2+(IR-1)*8
ADI=Leek(AD2)
SX1=Deek(ADI)*16
SY1=Deek(ADI+2)
H0TSP0T[I(CH)+S(CH)] : HY1=HY : HX1=HXREV
If H(CH)>32768
HR=H(CH)-32768+S(CH)
Else HR=H(CH)+S(CH)
End If
AD2=Start(1)+2+(HR-1)*8
ADI=Leek(AD2)
SX2=Deek(ADI)*16
SY2=Deek(ADI+2)
H0TSP0T[H(CH)+S(CH)] : HY2=HY : HX2=HXREV
XP=Max(HX1,HX2) : YP=Max(HY1,HY2)
Cls 0
Paste Bob XP-HX1,YP-HY1,I(CH)+S(CH)
Paste Bob XP-HX2,YP-HY2,H(CH)+S(CH)
SX=XP+Max(SX1-HX1,SX2-HX2)
SY=YP+Max(SY1-HY1,SY2-HY2)
Else
No Mask IR : Paste Bob 0,0,I(CH)+S(CH)
AD2=Start(1)+2+(IR-1)*8
ADI=Leek(AD2)
SX=Deek(ADI)*16
SY=Deek(ADI+2)
H0TSP0T[I(CH)+S(CH)] : YP=HY : XP=HXREV
End If
DX=Max((SX*Z(CH))/64,1)
DY=Max((SY*Z(CH))/64,1)
If Z(CH)<>64 : Z00M[SX,SY,DX,DY] : End If
Get Bob 6,2+CH,0,0 To Min(DX,64),Min(DY,100)
DY=(YP*Z(CH))/64+OFF(CH)-PY(CH)
DX=(XP*Z(CH))/64
Hot Spot 2+CH,DX,DY
End If
Screen 0 : Bob 20+CH,PX(CH),OFF(CH),2+CH
IL(CH)=I(CH) : ZL(CH)=Z(CH) : HL(CH)=H(CH)
End If
Else
Bob Off 20+CH
End If
Next
For B0B=0 To 15
If A(B0B,0)<>0
AD2=Start(30+B0B)+A(B0B,2)*6
XA=Deek(AD2) : If XA>32768 : XA=XA-65536 : End If
YA=Deek(AD2+2) : If YA>32768 : YA=YA-65536 : End If
FA=Deek(AD2+4) : If FA>32768 : FA=FA-65536 : End If
Bob B0B,XA,YA,FA+SOBJ
Inc A(B0B,2)
If A(B0B,2)=A(B0B,1)
If A(B0B,0)=1
A(B0B,0)=0
Else
A(B0B,2)=0
End If
End If
End If
Next
Synchro
Screen 0
If SCR0LL
XOFF=Min(Max(PX(MCH)-CSTUFF(2)/2,0),Max(Screen Width(0)-CSTUFF(2),0))
YOFF=Min(Max(PY(MCH)-CSTUFF(3)/2,0),Max(Screen Height(0)-CSTUFF(3),0))
End If
Screen Offset 0,XOFF,YOFF
Screen Swap : Wait Vbl
Gosub UPD4TESTUFF
Screen Swap : View : Wait Vbl
Gosub UPD4TESTUFF
VBL=VB : MGE=0 : PRT=0 : PASTE=0
End If
Else
If MGE=-1
Screen 7 : S$="" : While Text Length(S$)<LTXT : S$=S$+" " : Wend : LTXT=Text Length(MGE$)
End If
Screen Show 7 : Screen To Front 7
Screen Swap : Wait Vbl
Gosub UPD4TESTUFF2
Screen Swap : View : Wait Vbl
Gosub UPD4TESTUFF2
VBL=VB : MGE=0 : PRT=0 : PASTE=0
End If
If Timer-UTIME>4 : UTIME=Timer-4 : End If : Pop Proc
UPD4TESTUFF:
Bob Clear
If PASTE>0
H0TSP0T[PASTE]
Screen 0 : Paste Bob PASTEX-HXREV,PASTEY-HY,PASTE
End If
Bob Draw
UPD4TESTUFF2:
If VB<>VBL
Screen 7
If VBL<>-1
H0TSP0T[VB(7,VBL)+SCONT]
Paste Bob VB(5,VBL)-HXREV,VB(6,VBL)-HY,VB(7,VBL)+SCONT
End If
H0TSP0T[VB(0,VB)+SCONT]
Paste Bob VB(5,VB)-HXREV,VB(6,VB)-HY,VB(0,VB)+SCONT
End If
If MGE=-1
Screen 7
Ink CSTUFF(14),CSTUFF(15)
Text CSTUFF(10),CSTUFF(11),S$ : Text CSTUFF(10),CSTUFF(11),MGE$
End If
If PRT<>0
Screen 7
Ink CSTUFF(15) : Bar CSTUFF(6),CSTUFF(7) To CSTUFF(8),CSTUFF(9)
Ink CSTUFF(14),CSTUFF(15)
For W=1 To PRT
For E=0 To C0LUMN
Text CSTUFF(6)+E*ILEN,CSTUFF(7)+(PRT-W)*FH(0)+Text Base,PRT$(E,PRT-W)
Next
Next
End If
Return
ERR: ERR0R[-1,-1,-1]
End Proc
Procedure F0NT[F0NT$,SIZE,N]
F0NT(N)=1 : FH(N)=8 : F0NT=1
If F0NT$="" : Pop Proc : End If
While Left$(Font$(F0NT),1)-" "<>""
For W=Len(F0NT$)+1 To Len(Font$(F0NT))
If Val(Right$(Font$(F0NT),Len(Font$(F0NT))-W))<>0 : FSIZE=Val(Right$(Font$(F0NT),Len(Font$(F0NT))-W)) : Exit : End If
Next
If Lower$(Left$(Font$(F0NT),Len(F0NT$)))=Lower$(F0NT$)
If FSIZE=SIZE or SIZE=-1
F0NT(N)=F0NT : FH(N)=FSIZE : Exit
End If
End If
Inc F0NT
Wend
End Proc[F0NT]
Procedure MGE[TXT$]
MGE$=TXT$
MGE=-1
End Proc
Procedure PR1NT[TXT$]
CLICK=(TXT$<>"")
While TXT$<>""
If Left$(TXT$,1)=" " : TXT$=Right$(TXT$,Len(TXT$)-1) : End If
For Q=1 To Len(TXT$)
If Mid$(TXT$,Q,1)=" " or Q=Len(TXT$) or Mid$(TXT$,Q,1)="@"
If Text Length(Left$(TXT$,Q))>CSTUFF(8)-CSTUFF(6) or Q=Len(TXT$) or Mid$(TXT$,Q,1)="@"
Q1=Q
While Text Length(Left$(TXT$,Q1))>CSTUFF(8)-CSTUFF(6)
Repeat
Q1=Q1-1
Until Mid$(TXT$,Q1,1)=" "
Wend
PRT$(0,W)=Left$(TXT$,Q1)-"@" : Inc W
TXT$=Right$(TXT$,Len(TXT$)-Q1)
If W=MLINE : Exit 2 : End If
Exit
End If
End If
Next
Wend
If CLICK
PRT$(0,W)="<click to continue>" : Inc W
PRT=W
Else
PRT=1 : PRT$(0,0)=""
End If
INVD=0 : C0LUMN=0
End Proc[TXT$]
Procedure CHOOSE
Dim CHOOSE(10) : FIRSTC=0
CL1NE: PR1NT[""] : MGE[""] : UPD4TE[0]
For Q=0 To 10
CHOOSE(Q)=-1
Next
C=FIRSTC : W=0
Repeat
If CHO1CE(C)<>-1
If TXT$(CHO1CE(C))-" "<>""
PRT$(0,W)="* "+TXT$(CHO1CE(C)) : CHOOSE(W)=C : Inc W : Inc C
Else
Inc C
End If
Else
Inc C
End If
Until W=MLINE+1 or C=10
MORE=0 : LASTC=C : If LASTC=10 : LASTC=0 : End If
If C<>10
For E=C To 10 : If CHO1CE(E)<>-1 : MORE=-1 : End If : Next
Else If FIRSTC<>0
For E=0 To FIRSTC : If CHO1CE(E)<>-1 : MORE=-1 : End If : Next
End If
If MORE
If W=MLINE+1 : Dec W : Dec LASTC : End If
PRT$(0,W)="more..." : CHOOSE(W)=-2 : Inc W
End If
PRT=W
C=-1 : CL=-1
While Mouse Key<>0 : Wend
Do
If Timer-UTIME>5
UPD4TE[0]
End If
Screen 7 : X=X Screen(X Mouse) : Y=Y Screen(Y Mouse)
If X>CSTUFF(6) and Y>CSTUFF(7) and X<CSTUFF(8) and Y<CSTUFF(9)
E=(Y-CSTUFF(7))/FH(0)
If E>-1 and E<W
C=CHOOSE(E)
End If
If Mouse Key>0 and C<>-1
Exit
End If
Else
C=-1
End If
If CL<>C and C>-1
MGE[TXT$(CHO1CE(C))]
Else If CL<>C
MGE[""]
End If
CL=C
Loop
If C=-2 : FIRSTC=LASTC : Goto CL1NE : End If
While Mouse Key>0 : Wend
End Proc[C]
Procedure INVENTORY
For Q=0 To 4
For E=0 To 10
M1NV(Q,E)=-1 : PRT$(Q,E)=""
Next
Next
E=0 : W=0
For Q=FIRST To 99
If INV(11,Q)=B0B(ROOM(ROOMSEL,2),MCH+1)+1
PRT$(E,W)=INV$(Q) : M1NV(E,W)=Q
Inc W : If W=MLINE : Inc E : W=0 : If E=IN : Exit : End If : End If
End If
Next
If E>0 : W=MLINE : E=0 : End If
If Q<99
For E=Q+1 To 99
If INV(11,E)=B0B(ROOM(ROOMSEL,2),MCH+1)+1 : GE=E : PRT$(0,W)="more..." : M1NV(0,W)=-2 : Inc W : Exit : End If
Next
LAST=E
If E=100 : E=0 : End If
End If
If(Q>98 or E=0) and FIRST>0
For E=0 To FIRST-1
If INV(11,E)=B0B(ROOM(ROOMSEL,2),MCH+1)+1 : PRT$(0,W)="more..." : M1NV(0,W)=-2 : Inc W : Exit : End If
Next
LAST=E
If E=100 : E=0 : End If
End If
PRT=W : C0LUMN=IN
If W=0 : PR1NT[""] : End If
End Proc
Procedure SPEAK[X,Y,TXT$,PAL]
Dim SPEECH$(1) : T0TAL=0 : Erase 46
Screen 5 : Paper 0 : Curs Off : Cls 0 : Gr Writing 0
For E=0 To 1
If TXT$<>""
If Left$(TXT$,1)="�"
W=1
Repeat
Inc W
Until Mid$(TXT$,W,1)="�"
A$=Left$(TXT$,W)-"�"
TXT$=Right$(TXT$,Len(TXT$)-W)
Reserve As Work 46,600
AD=Start(46)
C=1
While Mid$(A$,C,1)="(" and AD<594+Start(46)
For A=0 To 1
R=C : Repeat : Inc C : Until Mid$(A$,C,1)="," or Mid$(A$,C,1)=")"
Doke AD,Val(Mid$(A$,R+1,C-R-1)) : AD=AD+2
Next
Inc C
Wend
End If
For Q=1 To Len(TXT$)
Gosub GTT
If Mid$(TXT$,Q,1)=" " or Q=Len(TXT$) or(T and E=1) or Mid$(TXT$,Q,1)="@"
T=Text Length(Left$(TXT$,Q)) : T1=Text Length(SPEECH$(0)) : LONG=(T>CSTUFF(2)-25) or(T>T1 and E=1)
Gosub GTT
If LONG or Q=Len(TXT$) or(T and E=1) or Mid$(TXT$,Q,1)="@"
Q1=Q
While Text Length(Left$(TXT$,Q1))>CSTUFF(2)-25 or(Text Length(Left$(TXT$,Q1))>T1 and E=1)
Repeat
Q1=Q1-1
Until Mid$(TXT$,Q1,1)=" "
Wend
SPEECH$(E)=Left$(TXT$,Q1)-"@"
If Left$(SPEECH$(E),1)=" " : SPEECH$(E)=Right$(SPEECH$(E),Len(SPEECH$(E))-1) : End If
If Left$(TXT$,Q1)-"@"<>Left$(TXT$,Q1) : EN=-1 : End If
TXT$=Right$(TXT$,Len(TXT$)-Q1)
If EN : Exit 2 : End If : Exit
End If
End If
Next
End If
Next
For E=0 To 1
If CU=0 and SPIC=0
TX=Min(Max(0,X-XOFF-Text Length(SPEECH$(E))/2),CSTUFF(2)-Text Length(SPEECH$(E)))
Screen 0
Else
TX=Min(Max(0,X-Text Length(SPEECH$(E))/2),CSTUFF(2)-Text Length(SPEECH$(E)))
Screen 2
End If
DARK=1 : For C=1 To 31 : If Colour(C)<Colour(DARK) : DARK=C : End If : Next
Screen 5 : Ink DARK
Text TX-1,Text Base+1+(FH(1)+1)*E,SPEECH$(E)
Text TX+1,Text Base+1+(FH(1)+1)*E,SPEECH$(E)
Text TX,Text Base+2+(FH(1)+1)*E,SPEECH$(E)
Text TX,Text Base+(FH(1)+1)*E,SPEECH$(E)
If PAL=0 : PAL=1 : For C=1 To 31 : If Colour(C)>Colour(PAL) : PAL=C : End If : Next : End If
Ink PAL
Text TX,Text Base+1+(FH(1)+1)*E,SPEECH$(E)
T0TAL=T0TAL+Len(SPEECH$(E))+5
Next
Get Bob 1,0,0 To CSTUFF(2),FH(1)*2+4
Hot Spot 1,0,1000-Max(YOFF,Y)
If CU=0 and SPIC=0
Screen 0 : Bob 17,XOFF,1000,1
Else
Screen 2 : Trap Double Buffer : Bob 17,0,1000,1
End If
Goto FINISH
GTT:
T=0 : Restore PUNC
Do
Read T$ : If T$="END" : Exit : End If
If Mid$(TXT$,Q,2)=T$ : T=-1 : End If
Loop
Return
PUNC:
Data ". ","? ","! ","END"
FINISH:
End Proc[TXT$]
Procedure FINDBUTTON
Screen 7
XB=X Screen(X Mouse) : YB=Y Screen(Y Mouse)
For Z0NE=0 To 9
If(XB>=VB(1,Z0NE))<>(XB>VB(3,Z0NE)) and(YB>=VB(2,Z0NE))<>(YB>VB(4,Z0NE)) and VO(Z0NE)=0
V1=VB : VB=Z0NE : ITEM=0 : OBJ2=-1 : OBJ=-1
If VB(10,VB)<7
MGE[VB$(0,VB)+Str$(VB)]
Else
V=50+VB
ST[V]
VB=V1
End If
Pop Proc
End If
Next
FINDINV[X Mouse,Y Mouse] : I=Param
If I=-2 : FIRST=LAST : INVD=0 : End If
End Proc
Procedure C0L[B0B,MX,MY]
C0L=0
Trap I=I Bob(B0B)
If Errtrap=0
H0TSP0T[I]
X1=X Hard(X Bob(B0B)-HXREV)-XOFF
Y1=Y Hard(Y Bob(B0B)-HY)-YOFF
AD=Start(1)+2+(I-1)*8
ADI=Leek(AD)
SX=Deek(ADI)
SY=Deek(ADI+2)
X2=X1+SX*16
Y2=Y1+SY
If(MY>=Y1)<>(MY>Y2) and(MX>=X1)<>(MX>X2) : C0L=-1 : End If
End If
End Proc[C0L]
Procedure ACTION
If ACTIVE(MCH)=0 : Pop Proc : End If
ST0P(MCH)=-1
While ACTIVE(MCH)<>-1 : Gosub CHECK : Wend
PR1NT[""]
If OBJ=-1 : Pop Proc : End If
If TYPE=0
ST=FR(VB+11,OBJ)
If FR$(OBJ)-" "="" : Pop Proc : End If
Else If TYPE=1
ST=BK(VB+11,OBJ)
'If Fire(1) : MGE[Str$(VB)+Str$(OBJ)+Str$(ST)] : Wait Key : End If
If BK$(OBJ)-" "="" : Pop Proc : End If
Else If TYPE=2
ST=INV(VB+1,OBJ)
If INV$(OBJ)-" "="" : Pop Proc : End If
Else If TYPE=3
ST=CHACT(VB+1,B0B(ROOM(ROOMSEL,2),OBJ+1))
If CH$(B0B(ROOM(ROOMSEL,2),OBJ+1))-" "="" : Pop Proc : End If
End If
If ST>-1
FIRSTLINE=-1 : ST[ST]
If FIRSTLINE=-2
V=50+VB
ST[V]
End If
Else
V=50+VB
ST[V]
End If
Pop Proc
CHECK:
If Timer-UTIME>5
UPD4TE[0]
End If
Return
End Proc
Procedure ST[W]
On Error Goto ERR
Dim LINE(4) : Dim TEST(10) : Dim F0R(10,2) : Dim C1(10) : Dim C2(10) : P0P=0
If W>200
FIRST1=201 : BANK=24
Else If W>149
FIRST1=150 : BANK=23
Else If W>59
FIRST1=60 : BANK=22
Else If W>49
FIRST1=50 : BANK=21
Else
FIRST1=0 : BANK=20
End If
ADS=Start(BANK)+6
If W>FIRST1
For Q=FIRST1 To W-1
Do
ADS=ADS+8 : If Peek$(ADS,1)="�" : ADS=ADS+2 : Exit : End If
Loop
Next
End If
LINE=0
If PAUSE=-1
LINE=PQ : ADS=ADS+LINE*8 : PAUSE=0
End If
Do
Gosub GTLINE
If FIRSTLINE=-1
If LINE(0)<>45
FIRSTLINE=-2 : Pop Proc
Else FIRSTLINE=0
End If
End If
Gosub CHECKKEY
If LINE(0)>0 and Not D0NT
'If Fire(1) : MGE[Str$(QG)+Str$(WG)+Str$(LINE(0))] : Wait Key : End If
Gosub LINE(0)
Else If(LINE(0)>=16 and LINE(0)<=20) or LINE(0)=27 or LINE(0)=28 or LINE(0)=24 or LINE(0)=100
Gosub LINE(0)
End If
If Peek$(ADS,1)="�" : Pop Proc : End If
Loop
'bell
1 Bell : Return
'execute
2 If ST>-1
ST[ST]
If P0P : Pop Proc : End If
Else If VB(11,VB)=0
TXT$=TXT$(VB(9,VB))
While TXT$<>""
PR1NT[TXT$]
TXT$=Param$
If CLICK
While Mouse Key=0 : Gosub CHECKKEY : Wend
While Mouse Key<>0 : Gosub CHECKKEY : Wend
End If
PR1NT[""]
Wend
Else If VB(11,VB)=1
CHS=MCH
TXT$=TXT$(VB(9,VB))
Gosub S4YIT
End If
Return
'go
3 If TYPE=0
If FR(1,OBJ)>-1
MOVE[FR(0,OBJ),FR(1,OBJ),MCH,FR(9,OBJ),FR(8,OBJ)]
If ACTIVE(MCH)=-1 : P0P=-1 : Pop Proc : End If
Else
P0P=-1 : Pop Proc
End If
Else If TYPE=1
If BK(21,OBJ)>-1
MOVE[BK(21,OBJ),BK(22,OBJ),MCH,BK(9,OBJ),BK(8,OBJ)]
If ACTIVE(MCH)=-1 : P0P=-1 : Pop Proc : End If
Else
P0P=-1 : Pop Proc
End If
Else If TYPE=3
X=PX(OBJ) : Y=PY(OBJ)
If SANG(OBJ)=0
X=X+25 : D=2
Else If SANG(OBJ)=1
Y=Y+15 : D=3
Else If SANG(OBJ)=$8000
X=X-25 : D=1
Else If SANG(OBJ)=2
Y=Y-15 : D=4
End If
PREMOVE[X,Y]
MOVE[XPM,YPM,MCH,-1,D]
If ACTIVE(MCH)=-1 : P0P=-1 : Pop Proc : End If
End If
Return
'wait stop
4 Gosub GTCH1
WA1TSTOP[CH1,LINE(1)]
If P0P : Pop Proc : End If
Return
'print
5 If LINE(1)=-1
If TYPE=0
TXT$=TXT$(FR(6,OBJ))
Else If TYPE=1
TXT$=TXT$(BK(6,OBJ))
Else If TYPE=2
TXT$=TXT$(INV(0,OBJ))
Else If TYPE=3
TXT$=TXT$(CHACT(0,B0B(ROOM(ROOMSEL,2),OBJ+1)))
End If
Else
TXT$=TXT$(LINE(1)-1)
End If
While TXT$<>""
PR1NT[TXT$]
TXT$=Param$
If CLICK
While Mouse Key=0 : Gosub CHECKKEY : Wend
While Mouse Key<>0 : Gosub CHECKKEY : Wend
End If
PR1NT[""]
Wend
Return
'reach
6 Gosub GTCH1
If LINE(2)=-1
If TYPE=0
HEIGHT=FR(7,OBJ)
Else If TYPE=1
HEIGHT=BK(7,OBJ)
End If
Else
HEIGHT=LINE(2)
End If
I0=I(CH1)
If HEIGHT=2
I(CH1)=I0+30
Else If HEIGHT=1
I(CH1)=I0+33
Else If HEIGHT=3
I(CH1)=I0+27
End If
FRAMECOUNT=3
Repeat
Gosub CHECKKEY
Until FRAMECOUNT=0
I(CH1)=I0
Return
'take
7 Gosub GTCH1
If LINE(2)=-1
OBJ1=OBJ
Else
OBJ1=16-LINE(2)
End If
If TYPE=0 and FR(3,OBJ1)>-1 and FR(10,OBJ1)<>0
'reach
I0=I(CH1)
If FR(7,OBJ1)=2
I(CH1)=I0+30
Else If FR(7,OBJ1)=1
I(CH1)=I0+33
End If
FRAMECOUNT=2
Repeat
Gosub CHECKKEY
Until FRAMECOUNT=0
INV(11,FR(3,OBJ1))=B0B(ROOM(ROOMSEL,2),CH1+1)+1 : INVD=0
I(CH1)=I0
If FR(10,OBJ)>0
FLAG[FR(10,OBJ),0]
Else If FR(10,OBJ)<0
FLAG[FR(10,OBJ),1]
Else
Bob Off OBJ1
End If
Else If VB(11,VB)=0
TXT$=TXT$(VB(9,VB))
While TXT$<>""
PR1NT[TXT$]
TXT$=Param$
If CLICK
While Mouse Key=0 : Gosub CHECKKEY : Wend
While Mouse Key<>0 : Gosub CHECKKEY : Wend
End If
PR1NT[""]
Wend
Else If VB(11,VB)=1
CHS=MCH
TXT$=TXT$(VB(9,VB))
Gosub S4YIT
End If
Return
'paste
8 If CU=0
If PASTE<>0
If UPD4TE=-1
FRAMECOUNT=1
Repeat
Gosub CHECKKEY
Until FRAMECOUNT=0
End If
End If
PASTEX=BK(4,LINE(1)-1)
PASTEY=BK(5,LINE(1)-1)
IMAGE=LINE(2) : If IMAGE<0 : IMAGE=Abs(IMAGE)+$8000 : End If
PASTE=IMAGE+SOBJ
If UPD4TE=0 or FRZE=-1
Screen 0
H0TSP0T[PASTE]
Bob Clear : Paste Bob PASTEX-HXREV,PASTEY-HY,PASTE : Bob Draw
Screen Swap : Wait Vbl
Bob Clear : Paste Bob PASTEX-HXREV,PASTEY-HY,PASTE : Bob Draw
Screen Swap : Wait Vbl
PASTE=0
End If
Gosub PTLOD
Else
IMAGE=LINE(2) : If IMAGE<0 : IMAGE=Abs(IMAGE)+$8000 : End If
C=16-LINE(1)
H0TSP0T[IMAGE+SCU]
Screen 2
Paste Bob CZONE(5,C)-HXREV,CZONE(6,C)-HY,IMAGE+SCU : Screen Swap : Wait Vbl
Paste Bob CZONE(5,C)-HXREV,CZONE(6,C)-HY,IMAGE+SCU : Screen Swap : Wait Vbl
End If
Return
'stop
9 Gosub GTCH1
ST0P(CH1)=-1
While ACTIVE(CH1)<>-1
Gosub CHECKKEY
Wend
ST0P(CH1)=0
Return
'say
10 Gosub GTCH1
If LINE(2)=-1
If TYPE=0
TXT$=TXT$(FR(6,OBJ))
Else If TYPE=1
TXT$=TXT$(BK(6,OBJ))
Else If TYPE=2
TXT$=TXT$(INV(0,OBJ))
Else If TYPE=3
TXT$=TXT$(CHACT(0,B0B(ROOM(ROOMSEL,2),OBJ+1)))
End If
Else
TXT$=TXT$(LINE(2)-1)
End If
CHS=CH1 : Gosub S4YIT
Return
'loadroom
11 UPD4TE[0] : STORECH
PNT=LINE(2)
ROOMSEL=LINE(1)-1
Trap Screen 0 : If Errtrap=0 : Flash Off : Fade 1 : Wait 15 : Screen Close 0 : End If
L0ADR[ROOMSEL]
FRZE=0
DR4WROOM[PNT,-1]
FRZE=0
P0P=-1 : Pop Proc
Return
'charframe
12 Gosub GTCH1
IMAGE=LINE(2) : If IMAGE<0 : IMAGE=Abs(IMAGE)+$8000 : End If
I(CH1)=IMAGE
Return
'objectframe
13 If LINE(1)<>-1
B0B=16-LINE(1)
Else
B0B=OBJ
End If
IMAGE=LINE(2) : If IMAGE<0 : IMAGE=Abs(IMAGE)+$8000 : End If
If B0BS=0 : B0BS : End If
Bob B0B,,,IMAGE+SOBJ
Return
'wait
14 If UPD4TE=-1
FRAMECOUNT=LINE(1)
Repeat
Gosub CHECKKEY
Until FRAMECOUNT=0
Else
WT=Timer
While Timer-WT<LINE(1)*5
Gosub CHECKKEY
Wend
End If
Return
'face
15 Gosub GTCH1
If ACTIVE(CH1)=-1
If LINE(2)>-1
TURN(CH1)=LINE(2)
End If
If TURN(CH1)=1
SANG(CH1)=0
Else If TURN(CH1)=2
SANG(CH1)=$8000
Else If TURN(CH1)=3
SANG(CH1)=2
Else If TURN(CH1)=4
SANG(CH1)=1
End If
TURN[SANG(CH1),CH1]
FRAMECOUNT=2
Repeat
Gosub CHECKKEY
Until FRAMECOUNT=0
I(CH1)=1+SANG(CH1)
If SANG(CH1)<100
H(CH1)=37+4*SANG(CH1)
Else H(CH1)=37+SANG(CH1)
End If
End If
Return
'compare flag
16 If D0NT=0
C1(LEVEL+1)=FLAG(LINE(1)) : C2(LEVEL+1)=FLAG(LINE(2))
Else
C1(LEVEL)=FLAG(LINE(1)) : C2(LEVEL)=FLAG(LINE(2))
End If
Return
'compare value
17 If D0NT=0
C2(LEVEL+1)=LINE(2) : C1(LEVEL+1)=FLAG(LINE(1))
Else
C2(LEVEL)=LINE(2) : C1(LEVEL)=FLAG(LINE(1))
End If
Return
'compare item
20 If D0NT=0
C1(LEVEL+1)=OBJ2+1
If LINE(1)<>-1
C2(LEVEL+1)=FLAG(LINE(1))
Else If LINE(2)<>-1
C2(LEVEL+1)=LINE(2)
End If
Else
C1(LEVEL)=OBJ2+1
If LINE(1)<>-1
C2(LEVEL)=FLAG(LINE(1))
Else If LINE(2)<>-1
C2(LEVEL)=LINE(2)
End If
End If
Return
'compare entry
52 If D0NT=0
C1(LEVEL+1)=ENTRY
If LINE(1)<>-1
C2(LEVEL+1)=FLAG(LINE(1))
Else If LINE(2)<>-1
C2(LEVEL+1)=LINE(2)
End If
Else
C1(LEVEL)=ENTRY+1
If LINE(1)<>-1
C2(LEVEL)=FLAG(LINE(1))
Else If LINE(2)<>-1
C2(LEVEL)=LINE(2)
End If
End If
Return
'if
18 If D0NT=0
Inc LEVEL
C1=C1(LEVEL) : C2=C2(LEVEL)
TEST(LEVEL)=1
If LINE(1)=1
If C1>C2 : TEST(LEVEL)=2 : End If
Else If LINE(1)=2
If C1>=C2 : TEST(LEVEL)=2 : End If
Else If LINE(1)=3
If C1=C2 : TEST(LEVEL)=2 : End If
Else If LINE(1)=4
If C1<=C2 : TEST(LEVEL)=2 : End If
Else If LINE(1)=5
If C1<C2 : TEST(LEVEL)=2 : End If
End If
If LINE(2)<>0
TEST(LEVEL)=3-TEST(LEVEL)
End If
If TEST(LEVEL)=1 : D0NT=-1 : End If
Else
Inc LEVEL
End If
Return
'end if
19 If TEST(LEVEL)<>0 : D0NT=0 : End If
TEST(LEVEL)=0
LEVEL=LEVEL-1
Return
'add item
21 Gosub GTCH2
INV(11,LINE(1)-1)=B0B(ROOM(ROOMSEL,2),CH2+1)+1 : INVD=0
Return
'drop item
22 Gosub GTCH2
If INV(11,LINE(1)-1)=B0B(ROOM(ROOMSEL,2),CH2+1)+1 : INV(11,LINE(1)-1)=0 : End If
INVD=0
Return
'set flag
23 FLAG[LINE(1),LINE(2)]
Return
'link
24 W=LINE(1) : Q=LINE(2)-1
ADS=Start(BANK)+6
If W>FIRST1
For E=FIRST1 To W-1
Do
ADS=ADS+8 : If Peek$(ADS,1)="�" : ADS=ADS+2 : Exit : End If
Loop
Next
End If
ADS=ADS+Q*8 : LINE=Q
Return
'choice
25 FLAG=LINE(2)
If FLAG>0
If FLAG(FLAG)<>0 : CHO1CE(CHO1CE)=LINE(1)-1 : End If
Else If FLAG<0
If FLAG(Abs(FLAG))=0 : CHO1CE(CHO1CE)=LINE(1)-1 : End If
Else
CHO1CE(CHO1CE)=LINE(1)-1
End If
CHO1CE=CHO1CE+1
Return
'choose
26 CHOOSE : C=Param+1
FLAG[LINE(1),C]
PR1NT[""]
If LINE(2)<>0
Gosub GTCH2
TXT$=TXT$(CHO1CE(C-1))
CHS=CH2 : Gosub S4YIT
End If
CHO1CE=0
For E=0 To 10 : CHO1CE(E)=-1 : Next
Return
'else
27 If TEST(LEVEL)=1 : D0NT=0 : End If
If TEST(LEVEL)=2 : D0NT=-1 : End If
Return
'elseif
28 If TEST(LEVEL)=1
C1=C1(LEVEL) : C2=C2(LEVEL)
TEST(LEVEL)=1
If LINE(1)=1
If C1>C2 : TEST(LEVEL)=2 : End If
Else If LINE(1)=2
If C1>=C2 : TEST(LEVEL)=2 : End If
Else If LINE(1)=3
If C1=C2 : TEST(LEVEL)=2 : End If
Else If LINE(1)=4
If C1<=C2 : TEST(LEVEL)=2 : End If
Else If LINE(1)=5
If C1<C2 : TEST(LEVEL)=2 : End If
End If
If LINE(2)<>0
TEST(LEVEL)=3-TEST(LEVEL)
End If
If TEST(LEVEL)=2 : D0NT=0 : End If
Else If TEST(LEVEL)=2
D0NT=-1
End If
Return
'script
29 S=LINE(1)
ST[S]
If P0P : Pop Proc : End If
Return
'random
32 FLAG[LINE(1),Rnd(LINE(2))]
Return
'add
33 FLAG[LINE(1),FLAG(LINE(1))+LINE(2)]
Return
'add flag
34 FLAG[LINE(1),FLAG(LINE(1))+FLAG(LINE(2))]
Return
'subtract flag
35 FLAG[LINE(1),FLAG(LINE(1))-FLAG(LINE(2))]
Return
'set string
36 TXT$(LINE(1)-1)=TXT$(LINE(2)-1)
Return
'add string
37 TXT$(LINE(1)-1)=TXT$(LINE(1)-1)+TXT$(LINE(2)-1)
Return
'flag to string
39 TXT$(LINE(1)-1)=Str$(FLAG(LINE(2)))-" "
Return
'for
40 Inc FLEVEL : F0R(FLEVEL,0)=LINE : F0R(FLEVEL,1)=W : F0R(FLEVEL,2)=LINE(1)
FLAG(F0R(FLEVEL,2))=LINE(2)
Return
'next
41 Inc FLAG(F0R(FLEVEL,2))
If FLAG(F0R(FLEVEL,2))>LINE(1)
F0R(FLEVEL,2)=0 : FLEVEL=FLEVEL-1
Else
W=F0R(FLEVEL,1) : Q=F0R(FLEVEL,0)
ADS=Start(BANK)+6
If W>FIRST1
For E=FIRST1 To W-1
Do
ADS=ADS+8 : If Peek$(ADS,1)="�" : ADS=ADS+2 : Exit : End If
Loop
Next
End If
ADS=ADS+Q*8 : LINE=Q
End If
Return
'clearstring
42 TXT$(LINE(1)-1)=""
Return
'copy flag
43 FLAG[LINE(1),FLAG(LINE(2))]
Return
'amal
44 If LINE(1)<>-1
B0B=16-LINE(1)
Else
B0B=OBJ
End If
If B0BS=0 : B0BS : End If
Channel B0B-1 To Bob B0B
Amal B0B-1,TXT$(LINE(2)-1)-"noloop"
Amal On
LODST(LODST,0)=LINE(0) : LODST(LODST,1)=16-B0B
If TXT$(LINE(2)-1)-"noloop"=TXT$(LINE(2)-1)
LODST(LODST,2)=LINE(2)
Else
LODST(LODST,2)=-1
End If
Inc LODST
Return
'no default
45 Return
'freeze
46 FRZE=-1
Return
'unfreeze
47 FRZE=0
Return
'load palette
48 PICSEL=LINE(1)-1
REQUEST[PIC(PICSEL),0]
Trap Load DEV$(PIC(PICSEL))+"GRAC"+Str$(PICSEL)+".picture",6
If Errtrap<>0 : ERR0R[4,PICSEL,1] : End If
Unpack 6 To 1 : Erase 6
Screen Hide 1
Gosub PTLOD
Return
'fade
49 Screen 1 : Screen Clone 4 : Screen 1 : Get Palette 0
If LINE(1)>0
Screen 0 : Flash Off : Fade LINE(1) To 4
FRAMECOUNT=LINE(1)*3
Repeat
Gosub CHECKKEY
Until FRAMECOUNT=0
Else
Screen 0 : Get Palette 4
End If
Screen Close 4
Gosub PTLOD
Return
'timer
50 T0TAL2=LINE(2)
TST=LINE(1)
T1MER=0
Return
'fade in
51 If CU=0
UPD4TE=-1
If B0BS=0 : B0BS : End If
UPD4TE[0] : NICEIFF[0]
Else
NICEIFF[2] : UCU=-1
End If
Return
'place character
53 Gosub GTCH1
PLACE[CH1,LINE(2)]
Return
'walk
54 Gosub GTCH1
PNT=16-LINE(2)
MOVE[PNT(0,PNT),PNT(1,PNT),CH1,PNT(3,PNT),PNT(2,PNT)]
Return
'timer off
55 T0TAL2=0
TST=0 : T1MER=0
Return
'sound left
56 SAM=LINE(1)-1
FRQ=LINE(2) : If FRQ<1 : FRQ=10 : End If
LSAM[SAM]
OK=Param
If OK
STSAM[%1,100+SAM,FRQ,0]
End If
Return
'sound right
57 SAM=LINE(1)-1
FRQ=LINE(2) : If FRQ<1 : FRQ=10 : End If
LSAM[SAM]
OK=Param
If OK
STSAM[%10,100+SAM,FRQ,0]
End If
Return
'sound centre
58 SAM=LINE(1)-1
FRQ=LINE(2) : If FRQ<1 : FRQ=10 : End If
LSAM[SAM]
OK=Param
If OK
STSAM[%11,100+SAM,FRQ,0]
End If
Return
'sound back
59 SAM=LINE(1)-1
FRQ=LINE(2) : If FRQ<1 : FRQ=10 : End If
LSAM[SAM]
OK=Param
If OK
STSAM[%1100,100+SAM,FRQ,-1]
End If
Gosub PTLOD
Return
'st play
60 Trap Extension_19_0016 2,LINE(1)
If LINE(2)=0 : MUS=LINE(1)
Else MUS=-1
End If
Return
'load sample
61 SAM=LINE(1)-1
LSAM[SAM]
Gosub PTLOD
Return
'bodyframe
62 Gosub GTCH1
IMAGE=LINE(2) : If IMAGE<0 : IMAGE=Abs(IMAGE)+$8000 : End If
BFRAME(CH1)=IMAGE
I(CH1)=IMAGE
Return
'erase sample
64 Erase 100+LINE(1)-1
Gosub PTLOD
Return
'hide
65 Screen Hide 7 : Hide On : View
Return
'show
66 Screen Show 7 : Screen To Front 7 : Show On : View
Return
'hide character
67 Gosub GTCH1
ACTIVE(CH1)=0
Return
'goto
68 W=LINE(1) : Q=LINE(2)-1
ADS=Start(BANK)+6
If W>FIRST1
For E=FIRST1 To W-1
Do
ADS=ADS+8 : If Peek$(ADS,1)="�" : ADS=ADS+2 : Exit : End If
Loop
Next
End If
ADS=ADS+Q*8 : LINE=Q
Return
'voice
69 If LINE(1)=-1
If TYPE=0
TXT$=TXT$(FR(6,OBJ))
Else If TYPE=1
TXT$=TXT$(BK(6,OBJ))
Else If TYPE=2
TXT$=TXT$(INV(0,OBJ))
Else If TYPE=3
TXT$=TXT$(CHACT(0,B0B(ROOM(ROOMSEL,2),OBJ+1)))
End If
Else
TXT$=TXT$(LINE(1)-1)
End If
If LINE(2)>0
VX=PNT(0,16-LINE(2)) : VY=PNT(1,16-LINE(2))
Else
VX=VO1CEX : VY=VO1CEY
End If
While Mouse Key<>0 : Gosub CHECKKEY : Wend
While TXT$<>""
SPEAK[VX,VY-VO1CEH,TXT$,VO1CEC] : TXT$=Param$
TIME=Timer : T=0
While Mouse Key=0 and T<T0TAL
If Timer-UTIME>5 : UPD4TE[0] : Gosub CHECKKEY2 : Inc T : End If
Wend
Bob Off 17 : UPD4TE[0]
While Mouse Key<>0 : Gosub CHECKKEY : Wend
Wend
Return
'set voice
70 VO1CEC=LINE(1) : VO1CEH=LINE(2)
Return
'music stop
71 Extension_19_0030
MUS=-1
Return
'restart
72 PNT=ST4RTPOINT
ROOMSEL=ST4RTROOM
MCH=ST4RTCH
MMCH=B0B(ROOM(ST4RTROOM,2),MCH+1)+1
CLEARALL
Erase 1
Screen 0 : Flash Off : Fade 1 : Wait 15 : Screen Close 0
L0ADC
L0ADR[ROOMSEL]
DR4WROOM[PNT,-1]
P0P=-1 : Pop Proc
Return
'character change
73 Gosub GTCH1
Gosub GTCH2
For E=0 To 4 : If CL(E,0)=B0B(ROOM(ROOMSEL,2),CH2+1) : S(CH1)=CL(E,1) : CC(CH1)=CH2 : End If : Next
I(CH)=1+SANG(CH)
If SANG(CH)<100
H(CH)=37+4*SANG(CH)
Else H(CH)=37+SANG(CH)
End If
Return
'show picture
74 PICSEL=LINE(1)-1
REQUEST[PIC(PICSEL),0]
Trap Load DEV$(PIC(PICSEL))+"GRAC"+Str$(PICSEL)+".picture",6
If Errtrap<>0 : ERR0R[4,PICSEL,1] : End If
Unpack 6 To 2 : Screen Hide 2 : Erase 6
Screen Display 2,CSTUFF(4),CSTUFF(5),,
Screen To Front 2 : NICEIFF[2]
SPIC=-1
Return
'picture off
75 Screen 2 : Fade 1 : Wait 15 : Screen Close 2
SPIC=0
Return
'wait click
76 While Mouse Key<>0 : Gosub CHECKKEY : Wend
If UPD4TE=-1
FRAMECOUNT=LINE(1)
Repeat
Gosub CHECKKEY
Until(FRAMECOUNT=0 and LINE(1)<>0) or Mouse Key<>0
FRAMECOUNT=0
Else
WT=Timer
While(Timer-WT<LINE(1)*5 or LINE(1)=0) and Mouse Key=0
Gosub CHECKKEY
Wend
End If
While Mouse Key<>0 : Gosub CHECKKEY : Wend
Return
'quit
77 End
Return
'play anim
78 AN1MSEL=LINE(1)-1
REQUEST[AN1M(AN1MSEL),0]
AN1M[DEV$(AN1M(AN1MSEL))+"GRAC"+Str$(AN1MSEL)+".anim",LINE(2)]
Return
'limbo
79 FRZE=-1
Screen 0 : Flash Off : Fade 1 : Wait 15
Screen Close 0 : Screen Close 6
OBJECT1=-1
While Length(1)>101 : Del Bob 102 : Wend
Sam Stop : For E=100 To 199 : If Length(E)>0 : Erase E : End If : Next : Extension_19_0062 15
For E=1 To 2 : OL(E,0)=-1 : OL(E,2)=0 : Next
For E=0 To 4 : CL(E,0)=-1 : Next
Return
'flash
80 Screen 0
Flash LINE(1),TXT$(LINE(2)-1)
Gosub PTLOD
Return
'fade picture
81 If LINE(1)>0
Screen 2 : Flash Off : Fade LINE(1) To 1 : Wait LINE(1)*15
Else
Screen 2 : Get Palette 1
End If
Return
'toggle flag
82 If FLAG(LINE(1))=0
FLAG[LINE(1),1]
Else
FLAG[LINE(1),0]
End If
Return
'scroll off
83 SCR0LL=0
Return
'scroll on
84 SCR0LL=-1
Return
'scroll
85 For S=1 To Max(LINE(1),LINE(2)) Step 5
If S<=LINE(1) : XOFF=XOFF+5*Sgn(LINE(1)) : End If
If S<=LINE(2) : YOFF=YOFF+5*Sgn(LINE(2)) : End If
XOFF=Min(Max(XOFF,0),Screen Width(0)-CSTUFF(2))
YOFF=Min(Max(YOFF,0),Screen Height(0)-CSTUFF(3))
FRAMECOUNT=1
Repeat : Gosub CHECKKEY : Until FRAMECOUNT=0
Next
Return
'switch
86 ST0P(MCH)=-1 : INVD=0 : PR1NT[""]
MMCH=LINE(1)
For E=0 To 4
If MMCH=B0B(ROOM(ROOMSEL,2),E+1)+1 : MCH=E : Exit : End If
Next
If ACTIVE(MCH)=0
AD0=Start(98)
AD=AD0+56*(MMCH-1)
R : ROOM=R
MCH=-1 : STORECH
ROOMSEL=ROOM
Trap Screen 0 : If Errtrap=0 : Flash Off : Fade 1 : Wait 15 : Screen Close 0 : End If
L0ADR[ROOMSEL]
For Q=0 To 4 : ACTIVE(Q)=0 : Next : GTCH
DR4WROOM[PNT,0]
For E=0 To 4
If MMCH=B0B(ROOM(ROOMSEL,2),E+1)+1 : MCH=E : Exit : End If
Next
UPD4TE=0 : B0BS=0 : LODST=0
ST[0]
If UPD4TE=0
UPD4TE=-1
If B0BS=0 : B0BS : End If
PR1NT[""] : INVD=0
UPD4TE[0] : NICEIFF[0] : Screen Show 7 : Show On
End If
P0P=-1 : Pop Proc
End If
IZL(MCH)=IZM(MCH)
IZM(MCH)=IZ(MCH)
Return
'control palette
87 PICSEL=LINE(1)-1
REQUEST[PIC(PICSEL),0]
Trap Load DEV$(PIC(PICSEL))+"GRAC"+Str$(PICSEL)+".picture",6
If Errtrap<>0 : ERR0R[4,PICSEL,1] : End If
Unpack 6 To 3 : Erase 6
Screen Hide 3
CPALETTE=PICSEL
Return
'fade control
88 Screen 3 : Screen Clone 4 : Screen 3 : Get Palette 7
If LINE(1)>0
Screen 7 : Flash Off : Fade LINE(1) To 4 : Wait LINE(1)*15
Else
Screen 7 : Get Palette 4
End If
Screen Close 4
Return
'exit close up
89 CU=0
Return
'close up
90 L0ADCU[LINE(1)-1]
Screen Hide 7 : View
CU=-1 : DR4WCU
If CU=-1
While Mouse Key<>0 : Gosub CHECKKEY : Wend
Do
While Mouse Key=0 : Gosub CHECKKEY : Wend
Screen 2 : X=X Screen(X Mouse) : Y=Y Screen(Y Mouse)
For R=0 To 15
If CZONE(0,R)>0
If X>CZONE(1,R) and X<CZONE(3,R) and Y>CZONE(2,R) and Y<CZONE(4,R)
H0TSP0T[CZONE(7,R)+SCU]
Screen 2 : For E=0 To 1 : Paste Bob CZONE(5,R)-HXREV,CZONE(6,R)-HY,CZONE(0,R)+SCU : Screen Swap : Wait Vbl : Next
While Mouse Key<>0 : Gosub CHECKKEY : Wend
H0TSP0T[CZONE(7,R)+SCU]
Screen 2 : For E=0 To 1 : Paste Bob CZONE(5,R)-HXREV,CZONE(6,R)-HY,CZONE(7,R)+SCU : Screen Swap : Wait Vbl : Next
If CZONE(8,R)>200
ST[CZONE(8,R)] : If P0P : Pop Proc : End If
If Not CU : Exit 2 : End If
End If
End If
End If
Next
Loop
End If
Screen 2 : Fade 1 : Wait 15 : Screen Close 2
Screen Show 7 : View
Return
'clear flags
91 For E=LINE(1) To LINE(2)
FLAG[E,0]
Next
Return
'cycle
92 Screen 0 : Shift Up 5,LINE(1),LINE(2),1
For E=0 To 31
PAL(E)=Colour(E)
Next
Gosub PTLOD
Return
'cycle off
93 Shift Off
For E=0 To 31
Colour E,PAL(E)
Next
Gosub PTLOD
Return
'save off
94 S4VE=-1
Return
'verb off
95 VO(9-LINE(1)+1)=-1
Return
'save on
96 S4VE=0
Return
'verb on
97 VO(9-LINE(1)+1)=0
Return
'walk off
98 NOW4LK=-1
Return
'walk on
99 NOW4LK=0
Return
'compare
100 If D0NT=0
C2(LEVEL+1)=LINE(2) : C1(LEVEL+1)=LINE(1)
Else
C2(LEVEL)=LINE(2) : C1(LEVEL)=LINE(1)
End If
Return
'comment
101 Return
'pause
102 PAUSE=LINE(1)
PQ=LINE : PST=W
T1MER2=0
P0P=-1 : Pop Proc
Return
'anim
103 If LINE(1)<>-1
B0B=16-LINE(1)
Else
B0B=OBJ
End If
A$=TXT$(LINE(2)-1)
Reserve As Work 30+B0B,600
AD1=Start(30+B0B)
A(B0B,1)=0 : A(B0B,2)=0
E=0 : Repeat : Inc E : Until Mid$(A$,E,1)="("
While Mid$(A$,E,1)="("
For A=0 To 2
R=E : Repeat : Inc E : Until Mid$(A$,E,1)="," or Mid$(A$,E,1)=")"
Doke AD1,Val(Mid$(A$,R+1,E-R-1)) : AD1=AD1+2
Next
Inc E : Inc A(B0B,1)
Wend
If Mid$(A$,5,1)="L"
A(B0B,0)=-1
Else
A(B0B,0)=1
End If
Gosub PTLOD
Return
'pause off
104 PAUSE=0
Return
'subtract
105 FLAG[LINE(1),FLAG(LINE(1))-LINE(2)]
Return
'set mark
106 Return
'goto mark
107 MARK=LINE(1) : LINE=0
ADS=Start(BANK)+6
If W>FIRST1
For E=FIRST1 To W-1
Do
ADS=ADS+8 : If Peek$(ADS,1)="�" : ADS=ADS+2 : Exit : End If
Loop
Next
End If
Do
Gosub GTLINE
If LINE(0)=106 and LINE(1)=MARK : LEVEL=0 : Exit : End If
Loop
Return
'end
108 Pop Proc
Return
'perspective
109 FLOOR=LINE(1)
HORIZON=LINE(2)
Return
'static
110 If LINE(1)<>-1
B0B=16-LINE(1)
Else
B0B=OBJ
End If
FR(21,B0B)=-1
Return
'scale
111 SCALE=Min(Max(0,LINE(1)),100)
Return
'position voice
112 VO1CEX=LINE(1) : VO1CEY=LINE(2)
Return
S4YIT:
While TXT$<>""
While Mouse Key<>0 : Gosub CHECKKEY : Wend
If OFF(CHS)<=HORIZON
Z(CHS)=(16*SCALE)/100
Else If OFF(CHS)=>FLOOR
Z(CHS)=(64*SCALE)/100
Else
Z(CHS)=((OFF(CHS)-HORIZON)*64*SCALE)/((FLOOR-HORIZON)*100)
End If
Z(CHS)=Max(16,Z(CHS))
SPEAK[PX(CHS),PY(CHS)-((80*Z(CHS))/64),TXT$,CH(B0B(ROOM(ROOMSEL,2),CHS+1),1)]
TXT$=Param$
TIME=Timer : H=H(CHS) : T=0 : FRAME=0 : BFRAME=BFRAME(CHS) : I=I(CHS)
While Mouse Key=0 and T<T0TAL
Gosub CHECKKEY2
If Timer-UTIME>5
UPD4TE[0]
Inc T : H(CHS)=H+Rnd(3)
If Length(46)>0 and T>=DELAY
AD1=Start(46)+FRAME*4 : Inc FRAME
IMAGE=Deek(AD1) : If IMAGE>32768 : IMAGE=IMAGE-65536 : End If
DELAY=T+Deek(AD1+2)
If IMAGE<0 : IMAGE=Abs(IMAGE)+$8000 : End If
If IMAGE=0 : IMAGE=I : Erase 46 : End If
BFRAME(CHS)=IMAGE
I(CHS)=IMAGE
End If
End If
Wend
BFRAME(CHS)=BFRAME
I(CHS)=I
Erase 46
Bob Off 17 : H(CHS)=H : UPD4TE[0]
While Mouse Key<>0 : Gosub CHECKKEY : Wend
Wend
Return
CHECKKEY:
If Timer-UTIME>5
UPD4TE[0]
End If
CHECKKEY2:
I$=Inkey$ : I1=Scancode : S1=Scanshift
If I1>79 and I1<90 and S1=0
LI1=I1 : LS1=S1
CHECK["load game"+Str$(I1-79)] : P=Param
If P
REQUEST[CH(99,0),-1]
If Exist(DEV$(CH(99,0))+"GRAC"+Str$(I1-80)+".save")
Trap Screen Close 2 : P0P=-1 : Pop Proc
End If
Else LI1=0
End If
Else If I$="q"
CHECK["quit?"] : P=Param
If P : End : End If
End If
Return
GTLINE:
For Q=0 To 2
LINE(Q)=Deek(ADS+Q*2) : If LINE(Q)>32768 : LINE(Q)=LINE(Q)-65536 : End If
Next
WG=W : QG=LINE : LINEG=LINE(0)
LINE(3)=Peek(ADS+6)
LINE(4)=Peek(ADS+7)
For E=1 To 2
If LINE(E+2)>0
If LINE(E+2)=1
LINE(E)=FLAG(LINE(E))
Else If LINE(E+2)=2
LINE(E)=ROOMSEL+1
Else If LINE(E+2)=3
LINE(E)=OBJ2+1
Else If LINE(E+2)=4
LINE(E)=MCH+1
Else If LINE(E+2)=5
LINE(E)=ENTRY
Else If LINE(E+2)=6
LINE(E)=GTIME
Else If LINE(E+2)=7
LINE(E)=RTIME
Else If LINE(E+2)=8
If TYPE=0
LINE(E)=16-OBJ
Else If TYPE=1
LINE(E)=OBJ+1
Else If TYPE=2
LINE(E)=OBJ+1
Else If TYPE=3
LINE(E)=OBJ+1
End If
Else If LINE(E+2)=9
If TYPE=0
LINE(E)=FR(6,OBJ)+1
Else If TYPE=1
LINE(E)=BK(6,OBJ)+1
Else If TYPE=2
LINE(E)=INV(0,OBJ)+1
Else If TYPE=3
LINE(E)=CHACT(0,B0B(ROOM(ROOMSEL,2),OBJ+1))+1
End If
Else If LINE(E+2)=10
If TYPE=0
LINE(E)=FR(7,OBJ)
Else If TYPE=1
LINE(E)=BK(7,OBJ)
End If
End If
End If
Next
Inc LINE : ADS=ADS+8
Return
GTCH1:
If LINE(1)=-1 or LINE(1)=0
CH1=MCH
Else
CH1=LINE(1)-1
End If
Return
GTCH2:
If LINE(2)=-1 or LINE(2)=0
CH2=MCH
Else
CH2=LINE(2)-1
End If
Return
PTLOD:
LODST(LODST,0)=LINE(0) : LODST(LODST,1)=LINE(1) : LODST(LODST,2)=LINE(2)
Inc LODST
Return
ERR: ERR0R[-1,-1,-1]
End Proc
Procedure FINDZONE[X,Y]
For Q=31 To 0 Step -1
If WK(0,Q)<>-1
If X>=WK(0,Q) and X<=WK(2,Q) and Y>=WK(1,Q) and Y<=WK(3,Q) and WK(12,Q)
Exit
End If
End If
Next
End Proc[Q]
Procedure FINDBACK[X,Y]
X=X Screen(X) : Y=Y Screen(Y)
For Q=31 To 0 Step -1
If BK(0,Q)<>-1 and BK(23,Q)=-1
If X>=BK(0,Q) and X<=BK(2,Q) and Y>=BK(1,Q) and Y<=BK(3,Q) and BK(23,Q)
Exit
End If
End If
Next
End Proc[Q]
Procedure FINDINV[X,Y]
If INVD=1
Screen 7 : X=X Screen(X) : Y=Y Screen(Y)
If X>CSTUFF(6) and Y>CSTUFF(7) and X<CSTUFF(8) and Y<CSTUFF(9)
Q=(X-CSTUFF(6))/ILEN
W=(Y-CSTUFF(7))/FH(0)
If Q>-1 and Q<5 and W>-1 and W<11
I=M1NV(Q,W)
Else
I=-1
End If
Else
I=-1
End If
Else
I=-1
End If
End Proc[I]
Procedure PREMOVE[X0,Y0]
FINDZONE[X0,Y0]
If Param<>-1 : XPM=X0 : YPM=Y0 : Pop Proc : End If
DX=1000 : DY=1000
For Q=0 To 31
If WK(0,Q)<>-1 and WK(12,Q)
If X0>=WK(0,Q) and X0<=WK(2,Q)
If Y0<WK(1,Q)
D=WK(1,Q)-Y0
Else
D=WK(3,Q)-Y0
End If
If Abs(D)<Abs(DY) : DY=D : End If
Else If Y0>=WK(1,Q) and Y0<=WK(3,Q)
If X0<WK(0,Q)
D=WK(0,Q)-X0
Else
D=WK(2,Q)-X0
End If
If Abs(D)<Abs(DX) : DX=D : End If
End If
End If
Next
If Abs(DX)>Abs(DY)
XPM=X0 : YPM=Y0+DY
Else
XPM=X0+DX : YPM=Y0
End If
End Proc
Procedure NICEIFF[SFADE]
Screen SFADE : Screen Clone 4 : Screen To Back 4
For W=0 To 31 : Colour W,0 : Next
View : Auto View On
Screen Show SFADE : Screen SFADE : Fade 1 To 4 : Screen Close 4 : Wait 15
Auto View Off
End Proc
Procedure FLAG[FLAG,V4LUE]
If FLAG=0 : Pop Proc : End If
FLAG=Abs(FLAG)
FLAG(FLAG)=V4LUE
Screen 0
For Q=0 To 15
If FR(0,Q)<>-1
If Abs(FR(10,Q))=FLAG
DR4W=-1
If FR(10,Q)>0
If FLAG(FR(10,Q))=0 : DR4W=0 : End If
Else If FR(10,Q)<0
If FLAG(-1*FR(10,Q))<>0 : DR4W=0 : End If
End If
If DR4W : Set Bob Q,FR(21,Q),, : Bob Q,FR(4,Q),FR(5,Q),FR(2,Q)+SOBJ : Else Bob Off Q : End If
End If
End If
If BK(0,Q)<>-1
If Abs(BK(10,Q))=FLAG
DR4W=-1
If BK(10,Q)>0
If FLAG(BK(10,Q))=0 : DR4W=0 : End If
Else If BK(10,Q)<0
If FLAG(-1*BK(10,Q))<>0 : DR4W=0 : End If
End If
If DR4W : BK(23,Q)=-1 : Else BK(23,Q)=0 : End If
End If
End If
Next
For Q=0 To 31
If WK(0,Q)<>-1
If Abs(WK(10,Q))=FLAG
DR4W=-1
If WK(10,Q)>0
If FLAG(WK(10,Q))=0 : DR4W=0 : End If
Else If WK(10,Q)<0
If FLAG(-1*WK(10,Q))<>0 : DR4W=0 : End If
End If
If DR4W : WK(12,Q)=-1 : Else WK(12,Q)=0 : End If
End If
End If
Next
End Proc
Procedure STSAM[VO1CE,BANK,FRQ,L00P]
If FRQ<100 : FRQ=FRQ*1000 : End If
If L00P
Sam Loop On
Else
Sam Loop Off
End If
Extension_19_0062 Not(VO1CE)
Sam Raw VO1CE,Start(BANK),Length(BANK),FRQ
If L00P
STIME=0
Else
STIME=Timer+(Length(BANK)*50)/FRQ
End If
End Proc
Procedure SAVGAME[N]
Reserve As Work 99,16000
AD=Start(99)
For Q=0 To 999
Loke AD,FLAG(Q) : AD=AD+4
Next
For Q=0 To 32
For W=0 To 2
For E=0 To 5
Loke AD,CRD(Q,W,E) : AD=AD+4
Next
Next
Next
For W=0 To 99
Loke AD,INV(11,W) : AD=AD+4
Next
For W=0 To 15
Loke AD,A(W,2) : AD=AD+4
Trap NL=I Bob(W)
If Errtrap=0
Loke AD,I Bob(W)-SOBJ : AD=AD+4
Else
Loke AD,-1 : AD=AD+4
End If
Loke AD,FR(21,W) : AD=AD+4
Next
For Q=0 To 4
For W=0 To 10
Loke AD,M1NV(Q,W) : AD=AD+4
Next
Next
For Q=0 To 10
Loke AD,CHO1CE(Q) : AD=AD+4
Next
For Q=0 To 9
Loke AD,VO(Q) : AD=AD+4
Next
For Q=0 To 255
For W=0 To 2
Loke AD,LODST(Q,W) : AD=AD+4
Next
Next
Loke AD,CPALETTE : AD=AD+4
For Q=0 To 31
If CPALETTE>-1
Screen 7 : Loke AD,Colour(Q) : AD=AD+4
Screen 3 : Loke AD,Colour(Q) : AD=AD+4
Else
AD=AD+4 : AD=AD+4
End If
Next
Repeat
Read Q : Loke AD,Q : AD=AD+4
Until Q=-2532
For Q=0 To 4
Loke AD,IZ(Q) : Loke AD+4,PX(Q) : Loke AD+8,PY(Q) : Loke AD+12,I(Q) : AD=AD+16
Loke AD,NL : Loke AD+4,OFF(Q) : Loke AD+8,CPT(Q) : Loke AD+12,TURN(Q) : AD=AD+16
Loke AD,BFRAME(Q) : Loke AD+4,FRAME(Q) : Loke AD+8,ANG(Q) : Loke AD+12,SANG(Q) : AD=AD+16
Loke AD,D(Q) : Loke AD+4,IPX(Q) : Loke AD+8,IPY(Q) : Loke AD+12,FPX(Q) : AD=AD+16
Loke AD,FPY(Q) : Loke AD+4,ACTIVE(Q) : Loke AD+8,W(Q) : Loke AD+12,E(Q) : AD=AD+16
Loke AD,CC(Q) : Loke AD+4,ST0P(Q) : Loke AD+8,FIRST(Q) : Loke AD+12,H(Q) : AD=AD+16
Loke AD,NL : Loke AD+4,IZM(Q) : Loke AD+8,IZL(Q) : Loke AD+12,0 : AD=AD+16
Next
Data NP,MCH,INVD,T0TAL,T1MER,TST,T0TAL2,VB,ROOMSEL,ITEM
Data OBJ,TYPE,OBJ2,TYPE2,FIRST,LAST,FRZE,ENTRY,VO1CEC,VO1CEH,VO1CEX,VO1CEY,FLOOR,HORIZON,SCALE
Data PASTEX,PASTEY,PASTE
Data XOFF,YOFF,SCR0LL,LODST,MUS,NOW4LK
Data PAUSE,PST,PQ,T1MER2,GTIME,RTIME
Data NL,NL,NL,NL,NL,NL,NL,NL
Data -2532
REQUEST[CH(99,0),-1]
If Param
Trap Save DEV$(CH(99,0))+"GRAC"+Str$(N)+".save",99
Trap Save DEV$(CH(99,0))+"GRAC"+Str$(N)+".csave",98
End If
Erase 99
End Proc
Procedure LODGAME[N]
Dim CC2(4) : Dim B(1,15)
REQUEST[CH(99,0),-1]
If Param=0 : Pop Proc : End If
Trap Load DEV$(CH(99,0))+"GRAC"+Str$(N)+".save",99
If Errtrap<>0
Pop Proc
End If
Load DEV$(CH(99,0))+"GRAC"+Str$(N)+".csave",98
Extension_19_0030
Trap Screen Close 2
Trap Screen 0 : If Errtrap=0 : Flash Off : Fade 1 : Wait 15 : Screen Close 0 : End If
AD=Start(99)
For Q=0 To 999
R : FLAG(Q)=R
Next
For Q=0 To 32
For W=0 To 2
For E=0 To 5
R : CRD(Q,W,E)=R
Next
Next
Next
For W=0 To 99
R : INV(11,W)=R
Next
For W=0 To 15
R : A(W,2)=R
R : B(1,W)=R
R : B(0,W)=R
Next
For Q=0 To 4
For W=0 To 10
R : M1NV(4,10)=R
Next
Next
For Q=0 To 10
R : CHO1CE(Q)=R
Next
For Q=0 To 9
R : VO(Q)=R
Next
For Q=0 To 255
For W=0 To 2
R : LODST(Q,W)=R
Next
Next
R : CPALETTE=R
If CPALETTE>-1
REQUEST[PIC(CPALETTE),0]
Trap Load DEV$(PIC(CPALETTE))+"GRAC"+Str$(CPALETTE)+".picture",6
If Errtrap<>0 : ERR0R[4,PICSEL,1] : End If
Unpack 6 To 3 : Erase 6
Screen Hide 3
End If
For Q=0 To 31
If CPALETTE>-1
Screen 7 : Colour Q,Leek(AD) : AD=AD+4
Screen 3 : Colour Q,Leek(AD) : AD=AD+4
Else
AD=AD+8
End If
Next
R : NP=R : R : MCH=R : R : INVD=R : R : T0TAL=R : R : T1MER=R : R : TST=R
R : T0TAL2=R : R : R : ROOMSEL2=R : R : ITEM=R
R : OBJ=R : R : TYPE=R : R : OBJ2=R : R : TYPE2=R : R : FIRST=R : R : LAST=R : R : FRZE=R
R : ENTRY=R : R : VO1CEC=R : R : VO1CEH=R : R : VO1CEX=R : R : VO1CEY=R : R : FLOOR2=R : R : HORIZON2=R : R : SCALE2=R
R : PASTEX=R : R : PASTEY=R : R : PASTE=R
R : XOFF=R : R : YOFF=R : R : SCR0LL=R : R : LODST=R : R : MUS=R : R : NOW4LK=R
R : PAUSE2=R : R : PST=R : R : PQ=R : R : T1MER2=R : R : RTIME=R : R : GTIME=R
R : NL=R : R : NL=R : R : NL=R : R : NL=R : R : NL=R : R : NL=R : R : NL=R : R : NL=R : R
For Q=0 To 4
R : IZ(Q)=R : R : PX(Q)=R : R : PY(Q)=R : R : I(Q)=R
R : NL=R : R : OFF(Q)=R : R : CPT(Q)=R : R : TURN(Q)=R
R : BFRAME(Q)=R : R : FRAME(Q)=R : R : ANG(Q)=R : R : SANG(Q)=R
R : D(Q)=R : R : IPX(Q)=R : R : IPY(Q)=R : R : FPX(Q)=R
R : FPY(Q)=R : R : ACTIVE(Q)=R : R : W(Q)=R : R : E(Q)=R
R : CC2(Q)=R : R : ST0P(Q)=R : R : FIRST(Q)=R : R : H(Q)=R
R : NL=R : R : IZM(Q)=R : R : IZL(Q)=R : R
Next
Erase 99
MMCH=B0B(ROOM(ROOMSEL2,2),MCH+1)+1
L0ADR[ROOMSEL2]
For Q=0 To 4
ZL(Q)=0 : HL(Q)=0 : IL(Q)=0
CC(Q)=CC2(Q)
For W=0 To 4
If CL(W,0)=B0B(ROOM(ROOMSEL2,2),CC(Q)+1) : S(Q)=CL(W,1) : Exit : End If
Next
Next
PAUSE=PAUSE2 : FLOOR=FLOOR2 : HORIZON=HORIZON2 : SCALE=SCALE2
INVD=0 : UPD4TE=0 : S4VE=0 : SPIC=0 : CU=0
DR4WROOM[PNT,0]
For W=0 To 15
FR(21,W)=B(0,W)
Next
B0BS
For W=0 To 15
FR(21,W)=B(0,W)
If B(1,W)<>-1 : Bob W,,,B(1,W)+SOBJ : End If
Next
LODST
If MUS<>-1
Trap Extension_19_0016 2,MUS
End If
UPD4TE=-1
UPD4TE[0] : NICEIFF[0] : Screen Show 7 : Show On
End Proc
Procedure CLEARALL
Extension_19_0030
For Q=1 To 999
FLAG(Q)=0
Next
For W=0 To 99
INV(11,W)=0
Next
For Q=0 To 10
CHO1CE(Q)=-1
Next
For Q=0 To 9
VO(Q)=0
Next
NP=0 : INVD=0 : T0TAL=0 : T1MER=0 : TST=0
T0TAL2=0 : ROOMSEL2=0 : ITEM=0
OBJ=0 : TYPE=0 : OBJ2=0 : TYPE2=0 : FIRST=0 : LAST=0 : FRZE=0
ENTRY=0 : VO1CEC=0 : VO1CEH=0 : VO1CEX=0 : VO1CEY=0 : FLOOR=0 : HORIZON=0 : SCALE=0
PASTEX=0 : PASTEY=0 : PASTE=0
XOFF=0 : YOFF=0 : LODST=0 : MUS=0 : NOW4LK=0 : S4VE=0
PAUSE=0 : PST=0 : PQ=0 : T1MER2=0 : GTIME=0 : RTIME=0
For E=0 To 2 : OL(E,0)=-1 : OL(E,1)=0 : OL(E,2)=0 : Next
For E=0 To 4 : CL(E,0)=-1 : CL(E,1)=0 : Next
For Q=0 To 4
IZ(Q)=0 : PX(Q)=0 : PY(Q)=0 : I(Q)=0
OFF(Q)=0 : CPT(Q)=0 : TURN(Q)=0
BFRAME(Q)=0 : FRAME(Q)=0 : ANG(Q)=0 : SANG(Q)=0
D(Q)=0 : IPX(Q)=0 : IPY(Q)=0 : FPX(Q)=0
FPY(Q)=0 : ACTIVE(Q)=0 : W(Q)=0 : E(Q)=0
ST0P(Q)=0 : FIRST(Q)=0 : H(Q)=0
IZM(Q)=0 : IZL(Q)=0
ZL(Q)=0 : HL(Q)=0 : IL(Q)=0
Next
Reserve As Work 98,5600
End Proc
Procedure R
P=Varptr(R) : Loke P,Leek(AD) : AD=AD+4
End Proc
Procedure RD
R=Deek(AD) : AD=AD+2
If R>32768 : R=R-65536 : End If
End Proc
Procedure RP
R=Peek(AD) : AD=AD+1
If R>128 : R=R-256 : End If
End Proc
Procedure RT
R$=Peek$(AD,1000,"�") : AD=AD+Len(R$)+1
End Proc
Procedure LODST
Q=0
Do
If Q=LODST : Pop Proc : End If
Gosub LODST(Q,0)*100
Inc Q
Loop
'paste
800 PASTEX=BK(4,LODST(Q,1)-1)
PASTEY=BK(5,LODST(Q,1)-1)
IMAGE=LODST(Q,2) : If IMAGE<0 : IMAGE=Abs(IMAGE)+$8000 : End If
PASTE=IMAGE+SOBJ
Screen 0
H0TSP0T[PASTE]
For E=0 To 1
Bob Clear : Paste Bob PASTEX-HXREV,PASTEY-HY,PASTE : Bob Draw : Screen Swap
Next
PASTE=0
Return
'amal
4400 B0B=16-LODST(Q,1)
Channel B0B-1 To Bob B0B
If LODST(Q,2)-1>-1
Trap Amal B0B-1,TXT$(LODST(Q,2)-1)
Else
Trap Amal B0B-1,""
End If
Amal On
Return
'load palette
4800 PICSEL=LODST(Q,1)-1
REQUEST[PIC(PICSEL),0]
Trap Load DEV$(PIC(PICSEL))+"GRAC"+Str$(PICSEL)+".picture",6
If Errtrap<>0 : ERR0R[4,PICSEL,1] : End If
Unpack 6 To 1 : Erase 6
Screen Hide 1
Return
'fade
4900 Screen 1 : Screen Clone 4 : Screen 1 : Get Palette 0
Screen 0 : Get Palette 4
Screen Close 4
Return
'sound back
5900 SAM=LODST(Q,1)-1
FRQ=LODST(Q,2) : If FRQ<1 : FRQ=10000 : End If
LSAM[SAM]
OK=Param
If OK
STSAM[%1100,100+SAM,FRQ,-1]
End If
Return
'load sample
6100 SAM=LODST(Q,1)-1
LSAM[SAM]
Return
'erase sample
6400 Erase 100+LODST(Q,1)-1
Return
'flash
8000 Screen 0
Flash LODST(Q,1),TXT$(LODST(Q,2)-1)
Return
'cycle
9200 Screen 0 : Shift Up 5,LODST(Q,1),LODST(Q,2),1
For E=0 To 31
PAL(E)=Colour(E)
Next
Return
'cycle off
9300 Shift Off
For E=0 To 31
Colour E,PAL(E)
Next
Return
'anim
10300 If LODST(Q,1)<>-1
OBJ=16-LODST(Q,1)
Else
OBJ=OBJ
End If
A$=TXT$(LODST(Q,2)-1)
Reserve As Work 30+OBJ,600
AD=Start(30+OBJ)
A(OBJ,1)=0
E=0 : Repeat : Inc E : Until Mid$(A$,E,1)="("
While Mid$(A$,E,1)="("
For A=0 To 2
R=E : Repeat : Inc E : Until Mid$(A$,E,1)="," or Mid$(A$,E,1)=")"
Doke AD,Val(Mid$(A$,R+1,E-R-1)) : AD=AD+2
Next
Inc E : Inc A(OBJ,1)
Wend
If Mid$(A$,5,1)="L"
A(OBJ,0)=-1
Else
A(OBJ,0)=1
End If
Return
End Proc
Procedure REQUEST[D,C]
E=-1 : M$=MGE$
Trap Q$=DEV$(D)
If Errtrap=0
If Not Exist(Q$)
For Q=1 To Len(Q$)
If Mid$(Q$,Q,1)=":"
If Scin(CSTUFF(0)+16,CSTUFF(1)+16)<0 : NO7=-1 : End If
Q$=Left$(Q$,Q)
If C
MGE["Please insert volume "+Q$+" (r. mouse cancel)"] : UPD4TE[-1]
Else
MGE["Please insert volume "+Q$] : UPD4TE[-1]
End If
While Not Exist(Q$) : If C and Mouse Key=2 : E=0 : Exit : End If : Wend
MGE[M$]
If NO7=-1 : Screen Hide 7 : End If
End If
Next
End If
Else
E=0
End If
End Proc[E]
Procedure CHECK[Q$]
E=0 : M=0 : M$=MGE$
If Scin(CSTUFF(0)+16,CSTUFF(1)+16)<0 : NO7=-1 : End If
MGE[Q$+" (l.mouse okay, r.mouse cancel)"] : UPD4TE[-1]
While Mouse Key<>0 : Wend
While M<>1 and M<>2
M=Mouse Key
If M=1 : E=-1 : Exit : End If
Wend
While Mouse Key<>0 : Wend
MGE[M$]
If NO7=-1 : Screen Hide 7 : End If
End Proc[E]
Procedure ERR0R[FILE,NO,TYPE]
For Q=0 To 7
Trap Screen Close Q
Next
Screen Open 0,320,200,2,Hires
Hide : Curs Off : Flash Off : Paper 0 : Pen 1 : Palette $0,$FFF : View
NO$="" : If NO>-1 : NO$=" "+Str$(NO+1) : End If
If TYPE=-1
Print "unclassified error"
Else If TYPE=0
Print "compression error: "+ER$(FILE)+NO$
Else If TYPE=1
Print "loading error: "+ER$(FILE)+NO$
Else If TYPE=2
Print "control panel error: no "+ER$(FILE)
Else If TYPE=3
Print "point error: "+ER$(FILE)+NO$
Else If TYPE=4
Print "room error: no "+ER$(FILE)
End If
Print
Print "room number "+Str$(ROOMSEL+1)
Print "script number "+Str$(WG)
Print "line number "+Str$(QG+1)
Print
Print "click to exit"
While Mouse Key=0 : Wend
While Mouse Key<>0 : Wend
End
End Proc
Procedure AN1M[NAME$,DELAY]
Trap Open In 1,NAME$
Trap N=Frame Load(1 To 10,1000)
If Errtrap=0
Close 1
P=Frame Play(10,1,2)
Double Buffer
NICEIFF[2]
For X=2 To N-2
P=Frame Play(P,1) : Wait Vbl
Screen Swap
Wait Vbl
If DELAY>0 : Wait DELAY : End If
Next
Wait 25
Fade 1 : Wait 15
Erase 10 : Screen Close 2
Else
Close 1 : Erase 10
End If
End Proc
Procedure STORECH
AD0=Start(98)
For Q=0 To 4
If Q<>MCH and ACTIVE(Q)<0
W=B0B(ROOM(ROOMSEL,2),Q+1)+1
AD=AD0+56*(W-1) : If AD-Start(98)>5600-56 : End : End If
Loke AD,ROOMSEL : Loke AD+4,PX(Q) : Loke AD+8,PY(Q) : Loke AD+12,I(Q) : AD=AD+16
Loke AD,NL : Loke AD+4,OFF(Q) : Loke AD+8,BFRAME(Q) : Loke AD+12,FRAME(Q) : AD=AD+16
Loke AD,ANG(Q) : Loke AD+4,SANG(Q) : Loke AD+8,H(Q) : Loke AD+12,NL : AD=AD+16
Loke AD,IZ(Q) : Loke AD+4,ACTIVE(Q)
End If
Next
End Proc
Procedure GTCH
AD0=Start(98)
For Q=0 To 4
If Q<>MCH
W=B0B(ROOM(ROOMSEL,2),Q+1)+1
AD=AD0+56*(W-1)
R : ROOM=R
If ROOM=ROOMSEL
R : PX(Q)=R : R : PY(Q)=R : R : I(Q)=R
R : NL=R : R : OFF(Q)=R : R : BFRAME(Q)=R : R : FRAME(Q)=R
R : ANG(Q)=R : R : SANG(Q)=R : R : H(Q)=R : R : NL=R
R : IZ(Q)=R : R : ACTIVE(Q)=R
End If
End If
Next
End Proc
Procedure DR4WCU
Unpack 6 To 2 : Screen Hide 2 : Erase 6
Screen Display 2,CSTUFF(4),CSTUFF(5),,
Double Buffer : Autoback 0
For Q=0 To 15
If CZONE(0,Q)>0
H0TSP0T[CZONE(7,Q)+SCU]
Paste Bob CZONE(5,Q)-HXREV,CZONE(6,Q)-HY,CZONE(7,Q)+SCU : Screen Swap : Wait Vbl
Paste Bob CZONE(5,Q)-HXREV,CZONE(6,Q)-HY,CZONE(7,Q)+SCU : Screen Swap : Wait Vbl
End If
Next
UCU=0
ST[201]
If UCU=0 : NICEIFF[2] : End If
End Proc
Procedure LSAM[SAM]
F$=DEV$(SAM(SAM))+"GRAC"+Str$(SAM)+".sample"
If Length(SAM+100)=0
REQUEST[SAM(SAM),0]
Trap Open In 1,F$
If Errtrap=0
L=Lof(1) : Close 1
Reserve As Chip Work 100+SAM,L
Bload F$,100+SAM
OK=-1
Else
OK=0
End If
Else
OK=-1
End If
End Proc[OK]
Procedure B0BS
Screen 0 : B0BS=-1
For Q=0 To 15
DR4W=-1
If FR(0,Q)<>-1
If FR(10,Q)>0
If FLAG(FR(10,Q))=0 : DR4W=0 : End If
Else If FR(10,Q)<0
If FLAG(-1*FR(10,Q))<>0 : DR4W=0 : End If
End If
If DR4W : Set Bob Q,FR(21,Q),, : Bob Q,FR(4,Q),FR(5,Q),FR(2,Q)+SOBJ : End If
End If
Next
End Proc
Procedure WA1TSTOP[C,L]
P0P=0
While ACTIVE(C)<-1
Gosub CHECKKEY
If L=0
M=Mouse Key
If M<>0 : NP=-1*M : ST0P(C)=-1 : P0P=-1 : End If
End If
If Timer-UTIME>5
IZL(C)=IZM(C)
UPD4TE[0] : IZM(C)=IZ(C)
If L=0
If IZM(C)<>IZL(C)
If WK(11,IZM(C))<>-1
ST[WK(11,IZM(C))]
End If
End If
End If
If T0TAL2>0 and T1MER>=T0TAL2
T0TAL2=0 : ST[TST]
End If
If PAUSE>0 and T1MER2>=PAUSE
PAUSE=-1 : ST[PST]
End If
End If
If P0P : Exit : End If
Wend
Pop Proc
CHECKKEY:
I$=Inkey$ : I1=Scancode : S1=Scanshift
If I1>79 and I1<90 and S1=0
LI1=I1 : LS1=S1
CHECK["load game"+Str$(I1-79)] : P=Param
If P
REQUEST[CH(99,0),-1]
If Exist(DEV$(CH(99,0))+"GRAC"+Str$(I1-80)+".save")
Trap Screen Close 2 : P0P=-1 : Pop Proc
End If
Else LI1=0
End If
Else If I$="q"
CHECK["quit?"] : P=Param
If P : End : End If
End If
Return
End Proc
Procedure Z00M[SX,SY,DX,DY]
If SY>99 : SY=99 : End If
If SX>32
Dreg(0)=1
Else Dreg(0)=0
End If
Dreg(1)=SY
Dreg(2)=DX
Dreg(3)=DY
Call 48,P(0),P(1),P(2),P(3),P(4)
S=Start(47)
Fill S To S+Length(47),0
T=0 : N=SX-DX : AD=S+16 : A=0
While T<N
If AD<Start(47)+SX
Poke AD,1 : Inc T : Add AD,16
Else
If A<8
Add A,8
Else If A<12
Add A,-4
Else If A<14
Add A,-10
Else If A<15
Add A,-13
Else
A=0
End If
AD=S+A
End If
Wend
L1=S : L=0 : Q=0
While Q<=DX
LL=L : QL=Q
While Peek(L1)=0 : Inc L : Inc L1 : Inc Q : Wend
Screen Copy 6,LL,0,L,DY To 6,QL,0
Repeat : Inc L : Inc L1 : Until Peek(L1)=0
Wend
End Proc
Procedure OPENFILE[DEV,Q$,L2,FILE,NO]
REQUEST[DEV,0]
Trap Q$=DEV$(DEV)+"GRAC"+Q$
Trap Open In 1,Q$
If Errtrap<>0 : ERR0R[FILE,NO,1] : End If
L=Lof(1) : Close 1
Reserve As Work 17,L2
Bload Q$,Start(17)
L1=Leek(Start(17))
If L1<>L2 : ERR0R[FILE,NO,0] : End If
L3= Extension_5_00E4(Start(17)+4,L-4)
AD=Start(17)+4
End Proc